@wix/form-public 0.209.0 → 0.210.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 +11 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27882,6 +27882,7 @@ function useFormView() {
|
|
|
27882
27882
|
}
|
|
27883
27883
|
return context;
|
|
27884
27884
|
}
|
|
27885
|
+
var FormValuesContext = /* @__PURE__ */ createContext(void 0);
|
|
27885
27886
|
|
|
27886
27887
|
// ../form-fields/dist/esm/ui/form/components/form/create-form-fields.js
|
|
27887
27888
|
var createFormFields = (_ref) => {
|
|
@@ -27911,16 +27912,18 @@ var createFormFields = (_ref) => {
|
|
|
27911
27912
|
}
|
|
27912
27913
|
}, /* @__PURE__ */ React42__default.createElement(FormViewContext.Provider, {
|
|
27913
27914
|
value: form
|
|
27915
|
+
}, /* @__PURE__ */ React42__default.createElement(FormValuesContext.Provider, {
|
|
27916
|
+
value: values
|
|
27914
27917
|
}, /* @__PURE__ */ React42__default.createElement(FormField, {
|
|
27915
27918
|
key: formField.id,
|
|
27916
27919
|
field: formField,
|
|
27917
27920
|
values,
|
|
27918
27921
|
errors,
|
|
27919
|
-
onFieldChange,
|
|
27920
27922
|
onBlur,
|
|
27921
27923
|
onFocus,
|
|
27924
|
+
onFieldChange,
|
|
27922
27925
|
FieldLayout
|
|
27923
|
-
}))))));
|
|
27926
|
+
})))))));
|
|
27924
27927
|
return {
|
|
27925
27928
|
id: formField.id,
|
|
27926
27929
|
fieldType: formField.fieldType,
|
|
@@ -31315,8 +31318,7 @@ var getFieldErrors = async (fieldsToValidate, form, addressTemplates, externalDa
|
|
|
31315
31318
|
return fieldErrors;
|
|
31316
31319
|
};
|
|
31317
31320
|
var findErrorByNormalizedPath = (fieldsToValidate, errorPath) => {
|
|
31318
|
-
|
|
31319
|
-
return !!fieldsToValidate.find((field) => path === field.path);
|
|
31321
|
+
return !!fieldsToValidate.find((field) => errorPath === field.path || errorPath.startsWith(`${field.path}/`));
|
|
31320
31322
|
};
|
|
31321
31323
|
function setValue(object, path, value) {
|
|
31322
31324
|
const delimiter = "/";
|
|
@@ -32807,7 +32809,7 @@ var NORMALIZED_VALUE = {
|
|
|
32807
32809
|
[FIELD_TYPES.MLA_STREET_NAME]: acceptStringValue,
|
|
32808
32810
|
[FIELD_TYPES.MLA_STREET_NUMBER]: acceptStringValue,
|
|
32809
32811
|
[FIELD_TYPES.MLA_APARTMENT]: acceptStringValue,
|
|
32810
|
-
[FIELD_TYPES.FULL_NAME]:
|
|
32812
|
+
[FIELD_TYPES.FULL_NAME]: acceptFullNameValue,
|
|
32811
32813
|
[FIELD_TYPES.FULL_NAME_FIRST_NAME]: acceptStringValue,
|
|
32812
32814
|
[FIELD_TYPES.FULL_NAME_LAST_NAME]: acceptStringValue,
|
|
32813
32815
|
[FIELD_TYPES.VAT_ID]: normalizeVatIDValue,
|
|
@@ -33003,6 +33005,10 @@ function acceptObjectValue({ fieldValue }) {
|
|
|
33003
33005
|
}
|
|
33004
33006
|
return typeof fieldValue === "object" ? fieldValue : EMPTY_VALUE;
|
|
33005
33007
|
}
|
|
33008
|
+
function acceptFullNameValue(args) {
|
|
33009
|
+
const result2 = acceptObjectValue(args);
|
|
33010
|
+
return result2 === EMPTY_VALUE ? {} : result2;
|
|
33011
|
+
}
|
|
33006
33012
|
function acceptRatingValue({ fieldValue }) {
|
|
33007
33013
|
const isEmptyValue = fieldValue === 0 || fieldValue === EMPTY_VALUE;
|
|
33008
33014
|
if (isEmptyValue) {
|