@formio/js 5.1.0-dev.6071.625cfbf → 5.1.0-dev.6072.881b120
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 +3 -3
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +4 -4
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +2 -1
- package/lib/cjs/components/_classes/component/Component.js +5 -2
- package/lib/cjs/components/editgrid/EditGrid.js +3 -1
- package/lib/cjs/components/survey/Survey.js +1 -1
- package/lib/cjs/components/unknown/Unknown.form.d.ts +1 -0
- package/lib/cjs/components/unknown/Unknown.form.js +1 -0
- package/lib/mjs/components/_classes/component/Component.d.ts +2 -1
- package/lib/mjs/components/_classes/component/Component.js +5 -2
- package/lib/mjs/components/editgrid/EditGrid.js +3 -1
- package/lib/mjs/components/survey/Survey.js +1 -1
- package/lib/mjs/components/unknown/Unknown.form.d.ts +1 -0
- package/lib/mjs/components/unknown/Unknown.form.js +1 -0
- package/package.json +1 -1
@@ -1011,9 +1011,10 @@ declare class Component extends Element {
|
|
1011
1011
|
* @param {boolean} dirty - If the component is dirty.
|
1012
1012
|
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
1013
1013
|
* @param {*} row - Contextual row data for this component.
|
1014
|
+
* @param {*} options - Additional options for validation.
|
1014
1015
|
* @returns {string} - The message to show when the component is invalid.
|
1015
1016
|
*/
|
1016
|
-
invalidMessage(data: any, dirty: boolean, ignoreCondition: boolean, row: any): string;
|
1017
|
+
invalidMessage(data: any, dirty: boolean, ignoreCondition: boolean, row: any, options?: any): string;
|
1017
1018
|
/**
|
1018
1019
|
* Returns if the component is valid or not.
|
1019
1020
|
* @param {*} data - The data to check if the component is valid.
|
@@ -2999,10 +2999,12 @@ class Component extends Element_1.default {
|
|
2999
2999
|
* @param {boolean} dirty - If the component is dirty.
|
3000
3000
|
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
3001
3001
|
* @param {*} row - Contextual row data for this component.
|
3002
|
+
* @param {*} options - Additional options for validation.
|
3002
3003
|
* @returns {string} - The message to show when the component is invalid.
|
3003
3004
|
*/
|
3004
|
-
invalidMessage(data, dirty, ignoreCondition, row) {
|
3005
|
+
invalidMessage(data, dirty, ignoreCondition, row, options = {}) {
|
3005
3006
|
var _a;
|
3007
|
+
const { local } = options;
|
3006
3008
|
if (!row) {
|
3007
3009
|
row = (0, utils_1.getContextualRowData)(this.component, data, this.paths);
|
3008
3010
|
}
|
@@ -3022,6 +3024,7 @@ class Component extends Element_1.default {
|
|
3022
3024
|
component: this.component,
|
3023
3025
|
data,
|
3024
3026
|
row,
|
3027
|
+
local,
|
3025
3028
|
path: this.path || this.component.key,
|
3026
3029
|
parent: (_a = this.parent) === null || _a === void 0 ? void 0 : _a.component,
|
3027
3030
|
paths: this.paths,
|
@@ -3200,7 +3203,7 @@ class Component extends Element_1.default {
|
|
3200
3203
|
row = row || this.data;
|
3201
3204
|
// Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
|
3202
3205
|
// as setValue. Historically, this was bypassed by a series of cached states around the data model
|
3203
|
-
// which caused its own problems. We need to ensure that premium and custom components do not fall into
|
3206
|
+
// which caused its own problems. We need to ensure that premium and custom components do not fall into
|
3204
3207
|
// an infinite loop by only checking this component once.
|
3205
3208
|
if (this.checkingData) {
|
3206
3209
|
return;
|
@@ -1107,7 +1107,9 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
1107
1107
|
errors.push(...this._errors);
|
1108
1108
|
return false;
|
1109
1109
|
}
|
1110
|
-
|
1110
|
+
// TODO: this is the only place invalidMessage gets called, and it's not clear why it's needed - we already validate the editGrid
|
1111
|
+
// component above with super.checkComponentValidity
|
1112
|
+
const message = this.invalid || this.invalidMessage(data, dirty, false, row, options);
|
1111
1113
|
if (allRowErrors.length && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submitted) && !message) {
|
1112
1114
|
this._errors = this.setCustomValidity(message, dirty);
|
1113
1115
|
errors.push(...this._errors);
|
@@ -120,7 +120,7 @@ class SurveyComponent extends Field_1.default {
|
|
120
120
|
return this.component.questions.reduce((result, question) => result && Boolean(value[question.value]), true);
|
121
121
|
}
|
122
122
|
getInputName(question) {
|
123
|
-
return `${this.options.name}[${question.value}]`;
|
123
|
+
return `${this.options.name}[${question.value}][${this.id}]`;
|
124
124
|
}
|
125
125
|
getValueAsString(value, options) {
|
126
126
|
if (options === null || options === void 0 ? void 0 : options.email) {
|
@@ -8,6 +8,7 @@ const Unknown_edit_display_1 = __importDefault(require("./editForm/Unknown.edit.
|
|
8
8
|
const utils_1 = __importDefault(require("../../components/_classes/component/editForm/utils"));
|
9
9
|
/**
|
10
10
|
* Unknown Component schema.
|
11
|
+
* @param {...any} extend
|
11
12
|
* @returns {object} - The Unknown Component edit form.
|
12
13
|
*/
|
13
14
|
function default_1(...extend) {
|
@@ -1011,9 +1011,10 @@ declare class Component extends Element {
|
|
1011
1011
|
* @param {boolean} dirty - If the component is dirty.
|
1012
1012
|
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
1013
1013
|
* @param {*} row - Contextual row data for this component.
|
1014
|
+
* @param {*} options - Additional options for validation.
|
1014
1015
|
* @returns {string} - The message to show when the component is invalid.
|
1015
1016
|
*/
|
1016
|
-
invalidMessage(data: any, dirty: boolean, ignoreCondition: boolean, row: any): string;
|
1017
|
+
invalidMessage(data: any, dirty: boolean, ignoreCondition: boolean, row: any, options?: any): string;
|
1017
1018
|
/**
|
1018
1019
|
* Returns if the component is valid or not.
|
1019
1020
|
* @param {*} data - The data to check if the component is valid.
|
@@ -2967,9 +2967,11 @@ export default class Component extends Element {
|
|
2967
2967
|
* @param {boolean} dirty - If the component is dirty.
|
2968
2968
|
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
2969
2969
|
* @param {*} row - Contextual row data for this component.
|
2970
|
+
* @param {*} options - Additional options for validation.
|
2970
2971
|
* @returns {string} - The message to show when the component is invalid.
|
2971
2972
|
*/
|
2972
|
-
invalidMessage(data, dirty, ignoreCondition, row) {
|
2973
|
+
invalidMessage(data, dirty, ignoreCondition, row, options = {}) {
|
2974
|
+
const { local } = options;
|
2973
2975
|
if (!row) {
|
2974
2976
|
row = getContextualRowData(this.component, data, this.paths);
|
2975
2977
|
}
|
@@ -2989,6 +2991,7 @@ export default class Component extends Element {
|
|
2989
2991
|
component: this.component,
|
2990
2992
|
data,
|
2991
2993
|
row,
|
2994
|
+
local,
|
2992
2995
|
path: this.path || this.component.key,
|
2993
2996
|
parent: this.parent?.component,
|
2994
2997
|
paths: this.paths,
|
@@ -3165,7 +3168,7 @@ export default class Component extends Element {
|
|
3165
3168
|
row = row || this.data;
|
3166
3169
|
// Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
|
3167
3170
|
// as setValue. Historically, this was bypassed by a series of cached states around the data model
|
3168
|
-
// which caused its own problems. We need to ensure that premium and custom components do not fall into
|
3171
|
+
// which caused its own problems. We need to ensure that premium and custom components do not fall into
|
3169
3172
|
// an infinite loop by only checking this component once.
|
3170
3173
|
if (this.checkingData) {
|
3171
3174
|
return;
|
@@ -1099,7 +1099,9 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1099
1099
|
errors.push(...this._errors);
|
1100
1100
|
return false;
|
1101
1101
|
}
|
1102
|
-
|
1102
|
+
// TODO: this is the only place invalidMessage gets called, and it's not clear why it's needed - we already validate the editGrid
|
1103
|
+
// component above with super.checkComponentValidity
|
1104
|
+
const message = this.invalid || this.invalidMessage(data, dirty, false, row, options);
|
1103
1105
|
if (allRowErrors.length && this.root?.submitted && !message) {
|
1104
1106
|
this._errors = this.setCustomValidity(message, dirty);
|
1105
1107
|
errors.push(...this._errors);
|
@@ -118,7 +118,7 @@ export default class SurveyComponent extends Field {
|
|
118
118
|
return this.component.questions.reduce((result, question) => result && Boolean(value[question.value]), true);
|
119
119
|
}
|
120
120
|
getInputName(question) {
|
121
|
-
return `${this.options.name}[${question.value}]`;
|
121
|
+
return `${this.options.name}[${question.value}][${this.id}]`;
|
122
122
|
}
|
123
123
|
getValueAsString(value, options) {
|
124
124
|
if (options?.email) {
|
@@ -3,6 +3,7 @@ import UnknownEditDisplay from './editForm/Unknown.edit.display';
|
|
3
3
|
import EditFormUtils from '../../components/_classes/component/editForm/utils';
|
4
4
|
/**
|
5
5
|
* Unknown Component schema.
|
6
|
+
* @param {...any} extend
|
6
7
|
* @returns {object} - The Unknown Component edit form.
|
7
8
|
*/
|
8
9
|
export default function (...extend) {
|