@wix/form-public 0.544.0 → 0.546.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.css +1 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -14178,12 +14178,15 @@ function mapToStringSchemaProperty(stringField, validationMode) {
|
|
|
14178
14178
|
const validationMessages = isStringType(stringField) ? setValidationMessages(STRING_VALIDATION_PROPERTIES, stringField) : {};
|
|
14179
14179
|
return {
|
|
14180
14180
|
type: PropertyTypes.STRING,
|
|
14181
|
-
maxLength:
|
|
14181
|
+
maxLength: getAllowedMaxLength(stringField),
|
|
14182
14182
|
...validationMessages,
|
|
14183
14183
|
...resolveAjvFormat(stringField),
|
|
14184
14184
|
...resolveRestrictedValidationProperties5(stringField, validationMode)
|
|
14185
14185
|
};
|
|
14186
14186
|
}
|
|
14187
|
+
function getAllowedMaxLength(stringField) {
|
|
14188
|
+
return stringField.format === types$1.Format.EMAIL ? EMAIL_MAX_LENGTH : ALLOWED_MAX_LENGTH;
|
|
14189
|
+
}
|
|
14187
14190
|
function isStringType(field) {
|
|
14188
14191
|
return "validationMessages" in field;
|
|
14189
14192
|
}
|
|
@@ -14195,7 +14198,10 @@ function resolveRestrictedValidationProperties5(stringField, validationMode) {
|
|
|
14195
14198
|
if (validationMode !== types.ValidationMode.UNRESTRICTED_UPDATE) {
|
|
14196
14199
|
return {
|
|
14197
14200
|
...setValidationProperties(STRING_VALIDATION_PROPERTIES.filter((property) => property !== "format"), stringField, {
|
|
14198
|
-
maxLength: (value) =>
|
|
14201
|
+
maxLength: (value) => {
|
|
14202
|
+
const allowedMaxLength = getAllowedMaxLength(stringField);
|
|
14203
|
+
return Math.min(value ?? allowedMaxLength, allowedMaxLength);
|
|
14204
|
+
}
|
|
14199
14205
|
}),
|
|
14200
14206
|
...stringFormatOptionsMapper(stringField.format, getDateTimeConstrains(stringField), void 0, stringField.phoneOptions),
|
|
14201
14207
|
...availabilitySchema
|
|
@@ -14238,7 +14244,7 @@ function getDateAvailability(field) {
|
|
|
14238
14244
|
const dateOptions = "dateOptions" in field ? field.dateOptions : void 0;
|
|
14239
14245
|
return dateOptions?.availability;
|
|
14240
14246
|
}
|
|
14241
|
-
var ALLOWED_MAX_LENGTH, formMap;
|
|
14247
|
+
var ALLOWED_MAX_LENGTH, EMAIL_MAX_LENGTH, formMap;
|
|
14242
14248
|
var init_string_schema_property_mapper = __esm({
|
|
14243
14249
|
"../form-validator/dist/esm/lib/submission-validation/mappers/string-schema-property-mapper.js"() {
|
|
14244
14250
|
init_lang();
|
|
@@ -14247,6 +14253,7 @@ var init_string_schema_property_mapper = __esm({
|
|
|
14247
14253
|
init_property_types();
|
|
14248
14254
|
init_string_format_options_mapper();
|
|
14249
14255
|
ALLOWED_MAX_LENGTH = 2e4;
|
|
14256
|
+
EMAIL_MAX_LENGTH = 254;
|
|
14250
14257
|
formMap = {
|
|
14251
14258
|
[types$1.Format.DATE]: [
|
|
14252
14259
|
"date"
|