@formio/js 5.0.0-dev.5841.9817451 → 5.0.0-dev.5844.c491f7d
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 +2 -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 +1 -1
- package/lib/cjs/components/day/Day.js +23 -10
- package/lib/cjs/components/radio/Radio.js +8 -0
- package/lib/mjs/components/_classes/component/Component.js +1 -1
- package/lib/mjs/components/day/Day.js +23 -10
- 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);
|
|
@@ -286,7 +286,7 @@ class DayComponent extends Field_1.default {
|
|
|
286
286
|
if (!this.component.fields.day.hide && maxDay) {
|
|
287
287
|
this.refs.day.max = maxDay;
|
|
288
288
|
}
|
|
289
|
-
if (maxDay && day > maxDay) {
|
|
289
|
+
if (maxDay && day > maxDay && this.refs.day) {
|
|
290
290
|
this.refs.day.value = this.refs.day.max;
|
|
291
291
|
}
|
|
292
292
|
updateValueAndSaveFocus(this.refs.month, 'month')();
|
|
@@ -496,27 +496,40 @@ class DayComponent extends Field_1.default {
|
|
|
496
496
|
if (defaultValue) {
|
|
497
497
|
defaults = defaultValue.split('/').map(x => parseInt(x, 10));
|
|
498
498
|
}
|
|
499
|
+
const isModalEditClosed = this.component.modalEdit && !this.componentModal.isOpened;
|
|
499
500
|
if (this.showDay && this.refs.day) {
|
|
500
|
-
day = parseInt(this.refs.day.value, 10);
|
|
501
|
+
day = (this.refs.day.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.day.value, 10);
|
|
501
502
|
}
|
|
502
|
-
if (day === undefined || lodash_1.default.isNaN(day)) {
|
|
503
|
-
day = defaults
|
|
503
|
+
if (day === undefined || lodash_1.default.isNaN(day) || value) {
|
|
504
|
+
day = (defaults.length !== 3)
|
|
505
|
+
? this.getDayWithHiddenFields(defaults).day
|
|
506
|
+
: (defaults[DAY] && !lodash_1.default.isNaN(defaults[DAY]) ? defaults[DAY] : 0);
|
|
504
507
|
}
|
|
505
508
|
if (this.showMonth && this.refs.month) {
|
|
506
509
|
// Months are 0 indexed.
|
|
507
|
-
month = parseInt(this.refs.month.value, 10);
|
|
510
|
+
month = (this.refs.month.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.month.value, 10);
|
|
508
511
|
}
|
|
509
|
-
if (month === undefined || lodash_1.default.isNaN(month)) {
|
|
510
|
-
month = defaults
|
|
512
|
+
if (month === undefined || lodash_1.default.isNaN(month) || value) {
|
|
513
|
+
month = (defaults.length !== 3)
|
|
514
|
+
? this.getDayWithHiddenFields(defaults).month
|
|
515
|
+
: (defaults[MONTH] && !lodash_1.default.isNaN(defaults[MONTH]) ? defaults[MONTH] : 0);
|
|
511
516
|
}
|
|
512
517
|
if (this.showYear && this.refs.year) {
|
|
513
|
-
year = parseInt(this.refs.year.value);
|
|
518
|
+
year = (this.refs.year.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.year.value);
|
|
514
519
|
}
|
|
515
|
-
if (year === undefined || lodash_1.default.isNaN(year)) {
|
|
516
|
-
year = defaults
|
|
520
|
+
if (year === undefined || lodash_1.default.isNaN(year) || value) {
|
|
521
|
+
year = (defaults.length !== 3)
|
|
522
|
+
? this.getDayWithHiddenFields(defaults).year
|
|
523
|
+
: (defaults[YEAR] && !lodash_1.default.isNaN(defaults[YEAR]) ? defaults[YEAR] : 0);
|
|
517
524
|
}
|
|
518
525
|
let result;
|
|
519
526
|
if (!day && !month && !year) {
|
|
527
|
+
if (!isModalEditClosed) {
|
|
528
|
+
this.dataValue = this.emptyValue;
|
|
529
|
+
if (this.options.building) {
|
|
530
|
+
this.triggerChange();
|
|
531
|
+
}
|
|
532
|
+
}
|
|
520
533
|
return null;
|
|
521
534
|
}
|
|
522
535
|
// 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);
|
|
@@ -284,7 +284,7 @@ export default class DayComponent extends Field {
|
|
|
284
284
|
if (!this.component.fields.day.hide && maxDay) {
|
|
285
285
|
this.refs.day.max = maxDay;
|
|
286
286
|
}
|
|
287
|
-
if (maxDay && day > maxDay) {
|
|
287
|
+
if (maxDay && day > maxDay && this.refs.day) {
|
|
288
288
|
this.refs.day.value = this.refs.day.max;
|
|
289
289
|
}
|
|
290
290
|
updateValueAndSaveFocus(this.refs.month, 'month')();
|
|
@@ -494,27 +494,40 @@ export default class DayComponent extends Field {
|
|
|
494
494
|
if (defaultValue) {
|
|
495
495
|
defaults = defaultValue.split('/').map(x => parseInt(x, 10));
|
|
496
496
|
}
|
|
497
|
+
const isModalEditClosed = this.component.modalEdit && !this.componentModal.isOpened;
|
|
497
498
|
if (this.showDay && this.refs.day) {
|
|
498
|
-
day = parseInt(this.refs.day.value, 10);
|
|
499
|
+
day = (this.refs.day.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.day.value, 10);
|
|
499
500
|
}
|
|
500
|
-
if (day === undefined || _.isNaN(day)) {
|
|
501
|
-
day = defaults
|
|
501
|
+
if (day === undefined || _.isNaN(day) || value) {
|
|
502
|
+
day = (defaults.length !== 3)
|
|
503
|
+
? this.getDayWithHiddenFields(defaults).day
|
|
504
|
+
: (defaults[DAY] && !_.isNaN(defaults[DAY]) ? defaults[DAY] : 0);
|
|
502
505
|
}
|
|
503
506
|
if (this.showMonth && this.refs.month) {
|
|
504
507
|
// Months are 0 indexed.
|
|
505
|
-
month = parseInt(this.refs.month.value, 10);
|
|
508
|
+
month = (this.refs.month.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.month.value, 10);
|
|
506
509
|
}
|
|
507
|
-
if (month === undefined || _.isNaN(month)) {
|
|
508
|
-
month = defaults
|
|
510
|
+
if (month === undefined || _.isNaN(month) || value) {
|
|
511
|
+
month = (defaults.length !== 3)
|
|
512
|
+
? this.getDayWithHiddenFields(defaults).month
|
|
513
|
+
: (defaults[MONTH] && !_.isNaN(defaults[MONTH]) ? defaults[MONTH] : 0);
|
|
509
514
|
}
|
|
510
515
|
if (this.showYear && this.refs.year) {
|
|
511
|
-
year = parseInt(this.refs.year.value);
|
|
516
|
+
year = (this.refs.year.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.year.value);
|
|
512
517
|
}
|
|
513
|
-
if (year === undefined || _.isNaN(year)) {
|
|
514
|
-
year = defaults
|
|
518
|
+
if (year === undefined || _.isNaN(year) || value) {
|
|
519
|
+
year = (defaults.length !== 3)
|
|
520
|
+
? this.getDayWithHiddenFields(defaults).year
|
|
521
|
+
: (defaults[YEAR] && !_.isNaN(defaults[YEAR]) ? defaults[YEAR] : 0);
|
|
515
522
|
}
|
|
516
523
|
let result;
|
|
517
524
|
if (!day && !month && !year) {
|
|
525
|
+
if (!isModalEditClosed) {
|
|
526
|
+
this.dataValue = this.emptyValue;
|
|
527
|
+
if (this.options.building) {
|
|
528
|
+
this.triggerChange();
|
|
529
|
+
}
|
|
530
|
+
}
|
|
518
531
|
return null;
|
|
519
532
|
}
|
|
520
533
|
// 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';
|