@formio/js 5.0.0-dev.5841.9817451 → 5.0.0-dev.5842.5155aaa
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 +1 -0
- package/dist/formio.form.js +3 -3
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +3 -3
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/components/_classes/component/Component.js +5 -7
- package/lib/cjs/components/day/Day.js +4 -3
- package/lib/cjs/components/radio/Radio.js +8 -0
- package/lib/mjs/components/_classes/component/Component.js +2 -4
- package/lib/mjs/components/day/Day.js +4 -3
- package/lib/mjs/components/radio/Radio.js +8 -0
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -3469,16 +3469,14 @@ class Component extends Element_1.default {
|
|
|
3469
3469
|
window.scrollTo(verticalOnly ? window.scrollX : left + window.scrollX, top + window.scrollY);
|
|
3470
3470
|
}
|
|
3471
3471
|
focus(index) {
|
|
3472
|
-
var _a, _b, _c
|
|
3472
|
+
var _a, _b, _c;
|
|
3473
3473
|
if ('beforeFocus' in this.parent) {
|
|
3474
3474
|
this.parent.beforeFocus(this);
|
|
3475
3475
|
}
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
}
|
|
3479
|
-
if ((_c = this.refs.input) === null || _c === void 0 ? void 0 : _c.length) {
|
|
3476
|
+
index = index || ((_a = this.refs.input) === null || _a === void 0 ? void 0 : _a.length) - 1;
|
|
3477
|
+
if ((_b = this.refs.input) === null || _b === void 0 ? void 0 : _b.length) {
|
|
3480
3478
|
const focusingInput = this.refs.input[index];
|
|
3481
|
-
if (((
|
|
3479
|
+
if (((_c = this.component.widget) === null || _c === void 0 ? void 0 : _c.type) === 'calendar') {
|
|
3482
3480
|
const sibling = focusingInput.nextSibling;
|
|
3483
3481
|
if (sibling) {
|
|
3484
3482
|
sibling.focus();
|
|
@@ -497,26 +497,27 @@ class DayComponent extends Field_1.default {
|
|
|
497
497
|
defaults = defaultValue.split('/').map(x => parseInt(x, 10));
|
|
498
498
|
}
|
|
499
499
|
if (this.showDay && this.refs.day) {
|
|
500
|
-
day = parseInt(this.refs.day.value, 10);
|
|
500
|
+
day = this.refs.day.value === '' ? '' : parseInt(this.refs.day.value, 10);
|
|
501
501
|
}
|
|
502
502
|
if (day === undefined || lodash_1.default.isNaN(day)) {
|
|
503
503
|
day = defaults[DAY] && !lodash_1.default.isNaN(defaults[DAY]) ? defaults[DAY] : 0;
|
|
504
504
|
}
|
|
505
505
|
if (this.showMonth && this.refs.month) {
|
|
506
506
|
// Months are 0 indexed.
|
|
507
|
-
month = parseInt(this.refs.month.value, 10);
|
|
507
|
+
month = this.refs.month.value === '' ? '' : parseInt(this.refs.month.value, 10);
|
|
508
508
|
}
|
|
509
509
|
if (month === undefined || lodash_1.default.isNaN(month)) {
|
|
510
510
|
month = defaults[MONTH] && !lodash_1.default.isNaN(defaults[MONTH]) ? defaults[MONTH] : 0;
|
|
511
511
|
}
|
|
512
512
|
if (this.showYear && this.refs.year) {
|
|
513
|
-
year = parseInt(this.refs.year.value);
|
|
513
|
+
year = this.refs.year.value === '' ? '' : parseInt(this.refs.year.value);
|
|
514
514
|
}
|
|
515
515
|
if (year === undefined || lodash_1.default.isNaN(year)) {
|
|
516
516
|
year = defaults[YEAR] && !lodash_1.default.isNaN(defaults[YEAR]) ? defaults[YEAR] : 0;
|
|
517
517
|
}
|
|
518
518
|
let result;
|
|
519
519
|
if (!day && !month && !year) {
|
|
520
|
+
this.dataValue = this.emptyValue;
|
|
520
521
|
return null;
|
|
521
522
|
}
|
|
522
523
|
// add trailing zeros if the data is showed
|
|
@@ -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();
|
|
@@ -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);
|
|
@@ -3434,9 +3434,7 @@ export default class Component extends Element {
|
|
|
3434
3434
|
if ('beforeFocus' in this.parent) {
|
|
3435
3435
|
this.parent.beforeFocus(this);
|
|
3436
3436
|
}
|
|
3437
|
-
|
|
3438
|
-
index = this.refs.input.length - 1;
|
|
3439
|
-
}
|
|
3437
|
+
index = index || this.refs.input?.length - 1;
|
|
3440
3438
|
if (this.refs.input?.length) {
|
|
3441
3439
|
const focusingInput = this.refs.input[index];
|
|
3442
3440
|
if (this.component.widget?.type === 'calendar') {
|
|
@@ -495,26 +495,27 @@ export default class DayComponent extends Field {
|
|
|
495
495
|
defaults = defaultValue.split('/').map(x => parseInt(x, 10));
|
|
496
496
|
}
|
|
497
497
|
if (this.showDay && this.refs.day) {
|
|
498
|
-
day = parseInt(this.refs.day.value, 10);
|
|
498
|
+
day = this.refs.day.value === '' ? '' : parseInt(this.refs.day.value, 10);
|
|
499
499
|
}
|
|
500
500
|
if (day === undefined || _.isNaN(day)) {
|
|
501
501
|
day = defaults[DAY] && !_.isNaN(defaults[DAY]) ? defaults[DAY] : 0;
|
|
502
502
|
}
|
|
503
503
|
if (this.showMonth && this.refs.month) {
|
|
504
504
|
// Months are 0 indexed.
|
|
505
|
-
month = parseInt(this.refs.month.value, 10);
|
|
505
|
+
month = this.refs.month.value === '' ? '' : parseInt(this.refs.month.value, 10);
|
|
506
506
|
}
|
|
507
507
|
if (month === undefined || _.isNaN(month)) {
|
|
508
508
|
month = defaults[MONTH] && !_.isNaN(defaults[MONTH]) ? defaults[MONTH] : 0;
|
|
509
509
|
}
|
|
510
510
|
if (this.showYear && this.refs.year) {
|
|
511
|
-
year = parseInt(this.refs.year.value);
|
|
511
|
+
year = this.refs.year.value === '' ? '' : parseInt(this.refs.year.value);
|
|
512
512
|
}
|
|
513
513
|
if (year === undefined || _.isNaN(year)) {
|
|
514
514
|
year = defaults[YEAR] && !_.isNaN(defaults[YEAR]) ? defaults[YEAR] : 0;
|
|
515
515
|
}
|
|
516
516
|
let result;
|
|
517
517
|
if (!day && !month && !year) {
|
|
518
|
+
this.dataValue = this.emptyValue;
|
|
518
519
|
return null;
|
|
519
520
|
}
|
|
520
521
|
// add trailing zeros if the data is showed
|
|
@@ -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';
|