@wix/form-public 0.544.0 → 0.545.0
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/index.cjs +10 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14168,12 +14168,15 @@ function mapToStringSchemaProperty(stringField, validationMode) {
|
|
|
14168
14168
|
const validationMessages = isStringType(stringField) ? setValidationMessages(STRING_VALIDATION_PROPERTIES, stringField) : {};
|
|
14169
14169
|
return {
|
|
14170
14170
|
type: PropertyTypes.STRING,
|
|
14171
|
-
maxLength:
|
|
14171
|
+
maxLength: getAllowedMaxLength(stringField),
|
|
14172
14172
|
...validationMessages,
|
|
14173
14173
|
...resolveAjvFormat(stringField),
|
|
14174
14174
|
...resolveRestrictedValidationProperties5(stringField, validationMode)
|
|
14175
14175
|
};
|
|
14176
14176
|
}
|
|
14177
|
+
function getAllowedMaxLength(stringField) {
|
|
14178
|
+
return stringField.format === Format$1.EMAIL ? EMAIL_MAX_LENGTH : ALLOWED_MAX_LENGTH;
|
|
14179
|
+
}
|
|
14177
14180
|
function isStringType(field) {
|
|
14178
14181
|
return "validationMessages" in field;
|
|
14179
14182
|
}
|
|
@@ -14185,7 +14188,10 @@ function resolveRestrictedValidationProperties5(stringField, validationMode) {
|
|
|
14185
14188
|
if (validationMode !== ValidationMode.UNRESTRICTED_UPDATE) {
|
|
14186
14189
|
return {
|
|
14187
14190
|
...setValidationProperties(STRING_VALIDATION_PROPERTIES.filter((property) => property !== "format"), stringField, {
|
|
14188
|
-
maxLength: (value) =>
|
|
14191
|
+
maxLength: (value) => {
|
|
14192
|
+
const allowedMaxLength = getAllowedMaxLength(stringField);
|
|
14193
|
+
return Math.min(value ?? allowedMaxLength, allowedMaxLength);
|
|
14194
|
+
}
|
|
14189
14195
|
}),
|
|
14190
14196
|
...stringFormatOptionsMapper(stringField.format, getDateTimeConstrains(stringField), void 0, stringField.phoneOptions),
|
|
14191
14197
|
...availabilitySchema
|
|
@@ -14228,7 +14234,7 @@ function getDateAvailability(field) {
|
|
|
14228
14234
|
const dateOptions = "dateOptions" in field ? field.dateOptions : void 0;
|
|
14229
14235
|
return dateOptions?.availability;
|
|
14230
14236
|
}
|
|
14231
|
-
var ALLOWED_MAX_LENGTH, formMap;
|
|
14237
|
+
var ALLOWED_MAX_LENGTH, EMAIL_MAX_LENGTH, formMap;
|
|
14232
14238
|
var init_string_schema_property_mapper = __esm({
|
|
14233
14239
|
"../form-validator/dist/esm/lib/submission-validation/mappers/string-schema-property-mapper.js"() {
|
|
14234
14240
|
init_lang();
|
|
@@ -14237,6 +14243,7 @@ var init_string_schema_property_mapper = __esm({
|
|
|
14237
14243
|
init_property_types();
|
|
14238
14244
|
init_string_format_options_mapper();
|
|
14239
14245
|
ALLOWED_MAX_LENGTH = 2e4;
|
|
14246
|
+
EMAIL_MAX_LENGTH = 254;
|
|
14240
14247
|
formMap = {
|
|
14241
14248
|
[Format$1.DATE]: [
|
|
14242
14249
|
"date"
|