@formio/js 5.0.0-dev.5836.bcc14e7 → 5.0.0-dev.5838.2779c5d
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 +27 -0
- package/dist/formio.form.js +5 -5
- 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/components/Components.js +4 -2
- package/lib/cjs/components/_classes/component/Component.js +2 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +1 -0
- package/lib/cjs/components/day/Day.js +9 -3
- package/lib/cjs/components/radio/Radio.js +8 -0
- package/lib/mjs/components/Components.js +4 -2
- package/lib/mjs/components/_classes/component/Component.js +2 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +1 -0
- package/lib/mjs/components/day/Day.js +9 -3
- package/lib/mjs/components/radio/Radio.js +8 -0
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const Component_1 = __importDefault(require("./_classes/component/Component"));
|
|
7
7
|
const utils_1 = __importDefault(require("./_classes/component/editForm/utils"));
|
|
8
8
|
const Component_form_1 = __importDefault(require("./_classes/component/Component.form"));
|
|
9
|
+
const utils_2 = require("../utils/utils");
|
|
9
10
|
const lodash_1 = __importDefault(require("lodash"));
|
|
10
11
|
class Components {
|
|
11
12
|
static set EditFormUtils(value) {
|
|
@@ -56,7 +57,8 @@ class Components {
|
|
|
56
57
|
static getComponentPath(component) {
|
|
57
58
|
var _a;
|
|
58
59
|
let path = '';
|
|
59
|
-
|
|
60
|
+
const componentKey = (0, utils_2.getComponentKey)(component.component);
|
|
61
|
+
if (componentKey) {
|
|
60
62
|
let thisPath = ((_a = component.options) === null || _a === void 0 ? void 0 : _a.parent) || component;
|
|
61
63
|
while (thisPath && !thisPath.allowData && thisPath.parent) {
|
|
62
64
|
thisPath = thisPath.parent;
|
|
@@ -68,7 +70,7 @@ class Components {
|
|
|
68
70
|
const rowIndex = component.row;
|
|
69
71
|
const rowIndexPath = rowIndex && !['container'].includes(thisPath.component.type) ? `[${Number.parseInt(rowIndex)}]` : '';
|
|
70
72
|
path = `${thisPath.path}${rowIndexPath}.`;
|
|
71
|
-
path +=
|
|
73
|
+
path += componentKey;
|
|
72
74
|
return lodash_1.default.trim(path, '.');
|
|
73
75
|
}
|
|
74
76
|
return path;
|
|
@@ -2965,7 +2965,7 @@ class Component extends Element_1.default {
|
|
|
2965
2965
|
if (this.options.alwaysDirty) {
|
|
2966
2966
|
flags.dirty = true;
|
|
2967
2967
|
}
|
|
2968
|
-
if (flags.fromSubmission && this.hasValue(data)) {
|
|
2968
|
+
if (flags.fromSubmission && this.hasValue(data) && !(this.pristine && this.protected)) {
|
|
2969
2969
|
flags.dirty = true;
|
|
2970
2970
|
}
|
|
2971
2971
|
this.setDirty(flags.dirty);
|
|
@@ -2992,6 +2992,7 @@ class Component extends Element_1.default {
|
|
|
2992
2992
|
value: this.validationValue,
|
|
2993
2993
|
path: this.path || this.component.key,
|
|
2994
2994
|
instance: this,
|
|
2995
|
+
form: this.root ? this.root._form : {},
|
|
2995
2996
|
scope: { errors: [] },
|
|
2996
2997
|
processors: [
|
|
2997
2998
|
process_1.validateProcessInfo
|
|
@@ -500,20 +500,26 @@ class DayComponent extends Field_1.default {
|
|
|
500
500
|
day = parseInt(this.refs.day.value, 10);
|
|
501
501
|
}
|
|
502
502
|
if (day === undefined || lodash_1.default.isNaN(day)) {
|
|
503
|
-
day = defaults
|
|
503
|
+
day = (defaults.length !== 3 && value)
|
|
504
|
+
? this.getDayWithHiddenFields(defaults).day
|
|
505
|
+
: (defaults[DAY] && !lodash_1.default.isNaN(defaults[DAY]) ? defaults[DAY] : 0);
|
|
504
506
|
}
|
|
505
507
|
if (this.showMonth && this.refs.month) {
|
|
506
508
|
// Months are 0 indexed.
|
|
507
509
|
month = parseInt(this.refs.month.value, 10);
|
|
508
510
|
}
|
|
509
511
|
if (month === undefined || lodash_1.default.isNaN(month)) {
|
|
510
|
-
month = defaults
|
|
512
|
+
month = (defaults.length !== 3 && value)
|
|
513
|
+
? this.getDayWithHiddenFields(defaults).month
|
|
514
|
+
: (defaults[MONTH] && !lodash_1.default.isNaN(defaults[MONTH]) ? defaults[MONTH] : 0);
|
|
511
515
|
}
|
|
512
516
|
if (this.showYear && this.refs.year) {
|
|
513
517
|
year = parseInt(this.refs.year.value);
|
|
514
518
|
}
|
|
515
519
|
if (year === undefined || lodash_1.default.isNaN(year)) {
|
|
516
|
-
year = defaults
|
|
520
|
+
year = (defaults.length !== 3 && value)
|
|
521
|
+
? this.getDayWithHiddenFields(defaults).year
|
|
522
|
+
: (defaults[YEAR] && !lodash_1.default.isNaN(defaults[YEAR]) ? defaults[YEAR] : 0);
|
|
517
523
|
}
|
|
518
524
|
let result;
|
|
519
525
|
if (!day && !month && !year) {
|
|
@@ -79,6 +79,14 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
79
79
|
}
|
|
80
80
|
return defaultValue;
|
|
81
81
|
}
|
|
82
|
+
resetValue() {
|
|
83
|
+
this.unset();
|
|
84
|
+
this.setValue(this.emptyValue, {
|
|
85
|
+
noUpdateEvent: true,
|
|
86
|
+
noValidate: true,
|
|
87
|
+
resetValue: true
|
|
88
|
+
});
|
|
89
|
+
}
|
|
82
90
|
get inputInfo() {
|
|
83
91
|
var _a;
|
|
84
92
|
const info = super.elementInfo();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Component from './_classes/component/Component';
|
|
2
2
|
import EditFormUtils from './_classes/component/editForm/utils';
|
|
3
3
|
import BaseEditForm from './_classes/component/Component.form';
|
|
4
|
+
import { getComponentKey } from '../utils/utils';
|
|
4
5
|
import _ from 'lodash';
|
|
5
6
|
export default class Components {
|
|
6
7
|
static _editFormUtils = EditFormUtils;
|
|
@@ -52,7 +53,8 @@ export default class Components {
|
|
|
52
53
|
*/
|
|
53
54
|
static getComponentPath(component) {
|
|
54
55
|
let path = '';
|
|
55
|
-
|
|
56
|
+
const componentKey = getComponentKey(component.component);
|
|
57
|
+
if (componentKey) {
|
|
56
58
|
let thisPath = component.options?.parent || component;
|
|
57
59
|
while (thisPath && !thisPath.allowData && thisPath.parent) {
|
|
58
60
|
thisPath = thisPath.parent;
|
|
@@ -64,7 +66,7 @@ export default class Components {
|
|
|
64
66
|
const rowIndex = component.row;
|
|
65
67
|
const rowIndexPath = rowIndex && !['container'].includes(thisPath.component.type) ? `[${Number.parseInt(rowIndex)}]` : '';
|
|
66
68
|
path = `${thisPath.path}${rowIndexPath}.`;
|
|
67
|
-
path +=
|
|
69
|
+
path += componentKey;
|
|
68
70
|
return _.trim(path, '.');
|
|
69
71
|
}
|
|
70
72
|
return path;
|
|
@@ -2929,7 +2929,7 @@ export default class Component extends Element {
|
|
|
2929
2929
|
if (this.options.alwaysDirty) {
|
|
2930
2930
|
flags.dirty = true;
|
|
2931
2931
|
}
|
|
2932
|
-
if (flags.fromSubmission && this.hasValue(data)) {
|
|
2932
|
+
if (flags.fromSubmission && this.hasValue(data) && !(this.pristine && this.protected)) {
|
|
2933
2933
|
flags.dirty = true;
|
|
2934
2934
|
}
|
|
2935
2935
|
this.setDirty(flags.dirty);
|
|
@@ -2956,6 +2956,7 @@ export default class Component extends Element {
|
|
|
2956
2956
|
value: this.validationValue,
|
|
2957
2957
|
path: this.path || this.component.key,
|
|
2958
2958
|
instance: this,
|
|
2959
|
+
form: this.root ? this.root._form : {},
|
|
2959
2960
|
scope: { errors: [] },
|
|
2960
2961
|
processors: [
|
|
2961
2962
|
validateProcessInfo
|
|
@@ -498,20 +498,26 @@ export default class DayComponent extends Field {
|
|
|
498
498
|
day = parseInt(this.refs.day.value, 10);
|
|
499
499
|
}
|
|
500
500
|
if (day === undefined || _.isNaN(day)) {
|
|
501
|
-
day = defaults
|
|
501
|
+
day = (defaults.length !== 3 && value)
|
|
502
|
+
? this.getDayWithHiddenFields(defaults).day
|
|
503
|
+
: (defaults[DAY] && !_.isNaN(defaults[DAY]) ? defaults[DAY] : 0);
|
|
502
504
|
}
|
|
503
505
|
if (this.showMonth && this.refs.month) {
|
|
504
506
|
// Months are 0 indexed.
|
|
505
507
|
month = parseInt(this.refs.month.value, 10);
|
|
506
508
|
}
|
|
507
509
|
if (month === undefined || _.isNaN(month)) {
|
|
508
|
-
month = defaults
|
|
510
|
+
month = (defaults.length !== 3 && value)
|
|
511
|
+
? this.getDayWithHiddenFields(defaults).month
|
|
512
|
+
: (defaults[MONTH] && !_.isNaN(defaults[MONTH]) ? defaults[MONTH] : 0);
|
|
509
513
|
}
|
|
510
514
|
if (this.showYear && this.refs.year) {
|
|
511
515
|
year = parseInt(this.refs.year.value);
|
|
512
516
|
}
|
|
513
517
|
if (year === undefined || _.isNaN(year)) {
|
|
514
|
-
year = defaults
|
|
518
|
+
year = (defaults.length !== 3 && value)
|
|
519
|
+
? this.getDayWithHiddenFields(defaults).year
|
|
520
|
+
: (defaults[YEAR] && !_.isNaN(defaults[YEAR]) ? defaults[YEAR] : 0);
|
|
515
521
|
}
|
|
516
522
|
let result;
|
|
517
523
|
if (!day && !month && !year) {
|
|
@@ -80,6 +80,14 @@ export default class RadioComponent extends ListComponent {
|
|
|
80
80
|
}
|
|
81
81
|
return defaultValue;
|
|
82
82
|
}
|
|
83
|
+
resetValue() {
|
|
84
|
+
this.unset();
|
|
85
|
+
this.setValue(this.emptyValue, {
|
|
86
|
+
noUpdateEvent: true,
|
|
87
|
+
noValidate: true,
|
|
88
|
+
resetValue: true
|
|
89
|
+
});
|
|
90
|
+
}
|
|
83
91
|
get inputInfo() {
|
|
84
92
|
const info = super.elementInfo();
|
|
85
93
|
info.type = 'input';
|