@itcase/forms 1.1.48 → 1.1.50
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/itcase-forms.cjs.js +13 -11
- package/dist/itcase-forms.esm.js +13 -11
- package/package.json +1 -1
package/dist/itcase-forms.cjs.js
CHANGED
|
@@ -2695,30 +2695,30 @@ const setErrorsMutator = (args, state) => {
|
|
|
2695
2695
|
const [fieldName, data] = args;
|
|
2696
2696
|
const submitError = data.submitError;
|
|
2697
2697
|
const fieldError = data.error;
|
|
2698
|
-
if (fieldName === 'non_field_errors') {
|
|
2698
|
+
if (fieldName === 'non_field_errors' || fieldName === finalForm.FORM_ERROR) {
|
|
2699
2699
|
// state.formState.invalid = true
|
|
2700
2700
|
// state.formState.valid = false
|
|
2701
2701
|
state.formState.error = fieldError;
|
|
2702
2702
|
state.formState.submitError = submitError;
|
|
2703
|
-
console.log('non_field_errors');
|
|
2704
|
-
console.log(data);
|
|
2705
|
-
console.log('non_field_errors');
|
|
2706
2703
|
} else if (fieldName in state.fields) {
|
|
2707
|
-
|
|
2704
|
+
state.fields[fieldName].touched = true;
|
|
2705
|
+
|
|
2706
|
+
// TODO: make clear error not by empty string check
|
|
2707
|
+
if (fieldError || fieldError === '') {
|
|
2708
2708
|
const errorsState = Object.assign({}, state.formState.errors, {
|
|
2709
2709
|
[fieldName]: fieldError
|
|
2710
2710
|
});
|
|
2711
|
-
state.fields[fieldName].touched = true;
|
|
2712
2711
|
state.fields[fieldName].error = fieldError;
|
|
2713
2712
|
state.formState.errors = errorsState;
|
|
2714
2713
|
}
|
|
2715
|
-
|
|
2714
|
+
|
|
2715
|
+
// TODO: make clear error not by empty string check
|
|
2716
|
+
if (submitError || submitError === '') {
|
|
2716
2717
|
const submitErrorsState = Object.assign({}, state.formState.submitErrors, {
|
|
2717
2718
|
[fieldName]: submitError
|
|
2718
2719
|
});
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
// state.fields[fieldName].submitSucceeded = false
|
|
2720
|
+
state.fields[fieldName].submitFailed = true;
|
|
2721
|
+
state.fields[fieldName].submitSucceeded = false;
|
|
2722
2722
|
state.fields[fieldName].submitError = submitError;
|
|
2723
2723
|
state.formState.submitErrors = submitErrorsState;
|
|
2724
2724
|
state.formState.submitFailed = true;
|
|
@@ -2795,6 +2795,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2795
2795
|
fieldsGap,
|
|
2796
2796
|
formName,
|
|
2797
2797
|
groupGap,
|
|
2798
|
+
heightClass,
|
|
2798
2799
|
language,
|
|
2799
2800
|
loader,
|
|
2800
2801
|
loaderAppearance,
|
|
@@ -2839,6 +2840,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2839
2840
|
tertiaryButtonLabelTextColor,
|
|
2840
2841
|
tertiaryButtonLabelTextWeight,
|
|
2841
2842
|
tertiaryButtonSize,
|
|
2843
|
+
widthClass,
|
|
2842
2844
|
before,
|
|
2843
2845
|
after,
|
|
2844
2846
|
isLoading,
|
|
@@ -2874,7 +2876,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2874
2876
|
submitError
|
|
2875
2877
|
}) => {
|
|
2876
2878
|
return /*#__PURE__*/React__default.default.createElement("form", {
|
|
2877
|
-
className: clsx__default.default(className, 'form', type && `form_type_${type}`, titlePosition && `form_title-position_${titlePosition}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass && `direction_${directionClass}`, fillClass && `fill_${fillClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, elevationClass && `elevation_${elevationClass}`),
|
|
2879
|
+
className: clsx__default.default(className, 'form', type && `form_type_${type}`, widthClass && `width_${widthClass}`, heightClass && `height_${heightClass}`, titlePosition && `form_title-position_${titlePosition}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass && `direction_${directionClass}`, fillClass && `fill_${fillClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, elevationClass && `elevation_${elevationClass}`),
|
|
2878
2880
|
name: formName
|
|
2879
2881
|
// We no need set reference to html element, we need reference to "final-form" instance
|
|
2880
2882
|
,
|
package/dist/itcase-forms.esm.js
CHANGED
|
@@ -2684,30 +2684,30 @@ const setErrorsMutator = (args, state) => {
|
|
|
2684
2684
|
const [fieldName, data] = args;
|
|
2685
2685
|
const submitError = data.submitError;
|
|
2686
2686
|
const fieldError = data.error;
|
|
2687
|
-
if (fieldName === 'non_field_errors') {
|
|
2687
|
+
if (fieldName === 'non_field_errors' || fieldName === FORM_ERROR) {
|
|
2688
2688
|
// state.formState.invalid = true
|
|
2689
2689
|
// state.formState.valid = false
|
|
2690
2690
|
state.formState.error = fieldError;
|
|
2691
2691
|
state.formState.submitError = submitError;
|
|
2692
|
-
console.log('non_field_errors');
|
|
2693
|
-
console.log(data);
|
|
2694
|
-
console.log('non_field_errors');
|
|
2695
2692
|
} else if (fieldName in state.fields) {
|
|
2696
|
-
|
|
2693
|
+
state.fields[fieldName].touched = true;
|
|
2694
|
+
|
|
2695
|
+
// TODO: make clear error not by empty string check
|
|
2696
|
+
if (fieldError || fieldError === '') {
|
|
2697
2697
|
const errorsState = Object.assign({}, state.formState.errors, {
|
|
2698
2698
|
[fieldName]: fieldError
|
|
2699
2699
|
});
|
|
2700
|
-
state.fields[fieldName].touched = true;
|
|
2701
2700
|
state.fields[fieldName].error = fieldError;
|
|
2702
2701
|
state.formState.errors = errorsState;
|
|
2703
2702
|
}
|
|
2704
|
-
|
|
2703
|
+
|
|
2704
|
+
// TODO: make clear error not by empty string check
|
|
2705
|
+
if (submitError || submitError === '') {
|
|
2705
2706
|
const submitErrorsState = Object.assign({}, state.formState.submitErrors, {
|
|
2706
2707
|
[fieldName]: submitError
|
|
2707
2708
|
});
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
// state.fields[fieldName].submitSucceeded = false
|
|
2709
|
+
state.fields[fieldName].submitFailed = true;
|
|
2710
|
+
state.fields[fieldName].submitSucceeded = false;
|
|
2711
2711
|
state.fields[fieldName].submitError = submitError;
|
|
2712
2712
|
state.formState.submitErrors = submitErrorsState;
|
|
2713
2713
|
state.formState.submitFailed = true;
|
|
@@ -2784,6 +2784,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
|
|
|
2784
2784
|
fieldsGap,
|
|
2785
2785
|
formName,
|
|
2786
2786
|
groupGap,
|
|
2787
|
+
heightClass,
|
|
2787
2788
|
language,
|
|
2788
2789
|
loader,
|
|
2789
2790
|
loaderAppearance,
|
|
@@ -2828,6 +2829,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
|
|
|
2828
2829
|
tertiaryButtonLabelTextColor,
|
|
2829
2830
|
tertiaryButtonLabelTextWeight,
|
|
2830
2831
|
tertiaryButtonSize,
|
|
2832
|
+
widthClass,
|
|
2831
2833
|
before,
|
|
2832
2834
|
after,
|
|
2833
2835
|
isLoading,
|
|
@@ -2863,7 +2865,7 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
|
|
|
2863
2865
|
submitError
|
|
2864
2866
|
}) => {
|
|
2865
2867
|
return /*#__PURE__*/React.createElement("form", {
|
|
2866
|
-
className: clsx(className, 'form', type && `form_type_${type}`, titlePosition && `form_title-position_${titlePosition}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass && `direction_${directionClass}`, fillClass && `fill_${fillClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, elevationClass && `elevation_${elevationClass}`),
|
|
2868
|
+
className: clsx(className, 'form', type && `form_type_${type}`, widthClass && `width_${widthClass}`, heightClass && `height_${heightClass}`, titlePosition && `form_title-position_${titlePosition}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass && `direction_${directionClass}`, fillClass && `fill_${fillClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, elevationClass && `elevation_${elevationClass}`),
|
|
2867
2869
|
name: formName
|
|
2868
2870
|
// We no need set reference to html element, we need reference to "final-form" instance
|
|
2869
2871
|
,
|