@itcase/forms 1.1.38 → 1.1.40
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 +21 -8
- package/dist/itcase-forms.esm.js +21 -8
- package/package.json +1 -1
package/dist/itcase-forms.cjs.js
CHANGED
|
@@ -479,6 +479,7 @@ const FileInputDropzone = /*#__PURE__*/React__default.default.memo(function File
|
|
|
479
479
|
thumbColumn,
|
|
480
480
|
isPreviews,
|
|
481
481
|
onAddFiles,
|
|
482
|
+
onClickPreview,
|
|
482
483
|
onDeleteFile
|
|
483
484
|
} = props;
|
|
484
485
|
|
|
@@ -661,6 +662,9 @@ const FileInputDropzone = /*#__PURE__*/React__default.default.memo(function File
|
|
|
661
662
|
}, /*#__PURE__*/React__default.default.createElement("img", {
|
|
662
663
|
className: "form-dropzone__thumb-image-inner",
|
|
663
664
|
src: file.preview || file.image,
|
|
665
|
+
onClick: event => {
|
|
666
|
+
onClickPreview && onClickPreview(file, event);
|
|
667
|
+
},
|
|
664
668
|
onLoad: () => {
|
|
665
669
|
// Revoke data uri after image is loaded
|
|
666
670
|
URL.revokeObjectURL(file.preview);
|
|
@@ -820,6 +824,7 @@ const FileInput = /*#__PURE__*/React__default.default.memo(function FileInput(pr
|
|
|
820
824
|
isPreviews,
|
|
821
825
|
isRequired,
|
|
822
826
|
onAddFiles,
|
|
827
|
+
onClickPreview,
|
|
823
828
|
onDeleteFile
|
|
824
829
|
} = props;
|
|
825
830
|
const propsGenerator = useDevicePropsGenerator.useDevicePropsGenerator(props);
|
|
@@ -954,6 +959,7 @@ const FileInput = /*#__PURE__*/React__default.default.memo(function FileInput(pr
|
|
|
954
959
|
thumbNameTextWrap: thumbNameTextWrap,
|
|
955
960
|
isPreviews: isPreviews,
|
|
956
961
|
onAddFiles: onAddFiles,
|
|
962
|
+
onClickPreview: onClickPreview,
|
|
957
963
|
onDeleteFile: onDeleteFile
|
|
958
964
|
}));
|
|
959
965
|
});
|
|
@@ -1379,8 +1385,8 @@ const FormFieldCode = /*#__PURE__*/React__default.default.memo(function FormFiel
|
|
|
1379
1385
|
const {
|
|
1380
1386
|
name,
|
|
1381
1387
|
initialValue,
|
|
1382
|
-
messageType,
|
|
1383
1388
|
label,
|
|
1389
|
+
messageType,
|
|
1384
1390
|
isDisabled,
|
|
1385
1391
|
classNameGroupItem,
|
|
1386
1392
|
fieldProps = {},
|
|
@@ -1433,9 +1439,9 @@ const FormFieldCode = /*#__PURE__*/React__default.default.memo(function FormFiel
|
|
|
1433
1439
|
isValidState: isValidState
|
|
1434
1440
|
}, fieldProps), /*#__PURE__*/React__default.default.createElement(Code.Code, Object.assign({
|
|
1435
1441
|
name: input.name,
|
|
1442
|
+
initialValue: input.value,
|
|
1436
1443
|
isDisabled: isDisabled,
|
|
1437
1444
|
autoComplete: "nope",
|
|
1438
|
-
value: input.value,
|
|
1439
1445
|
onBlur: input.onBlur,
|
|
1440
1446
|
onChange: input.onChange,
|
|
1441
1447
|
onFocus: input.onFocus
|
|
@@ -2237,9 +2243,9 @@ const FormFieldMaskedInput = /*#__PURE__*/React__default.default.memo(function F
|
|
|
2237
2243
|
|
|
2238
2244
|
const {
|
|
2239
2245
|
ref,
|
|
2246
|
+
setUnmaskedValue,
|
|
2240
2247
|
unmaskedValue,
|
|
2241
|
-
value
|
|
2242
|
-
setUnmaskedValue
|
|
2248
|
+
value
|
|
2243
2249
|
} = reactImask.useIMask(optionsMask, {
|
|
2244
2250
|
onAccept: (newValue, event, element) => {
|
|
2245
2251
|
if (element) {
|
|
@@ -2252,6 +2258,11 @@ const FormFieldMaskedInput = /*#__PURE__*/React__default.default.memo(function F
|
|
|
2252
2258
|
setUnmaskedValue(input.value.replace(unmasked, ''));
|
|
2253
2259
|
}
|
|
2254
2260
|
}, [input.value]);
|
|
2261
|
+
React.useEffect(() => {
|
|
2262
|
+
if (unmaskedValue !== input.value) {
|
|
2263
|
+
input.onChange(unmaskedValue);
|
|
2264
|
+
}
|
|
2265
|
+
}, [unmaskedValue]);
|
|
2255
2266
|
const {
|
|
2256
2267
|
errorKey,
|
|
2257
2268
|
errorMessage,
|
|
@@ -2593,6 +2604,9 @@ const setErrorsMutator = (args, state) => {
|
|
|
2593
2604
|
// state.formState.valid = false
|
|
2594
2605
|
state.formState.error = fieldError;
|
|
2595
2606
|
state.formState.submitError = submitError;
|
|
2607
|
+
console.log('non_field_errors');
|
|
2608
|
+
console.log(data);
|
|
2609
|
+
console.log('non_field_errors');
|
|
2596
2610
|
} else if (fieldName in state.fields) {
|
|
2597
2611
|
if (fieldError) {
|
|
2598
2612
|
const errorsState = Object.assign({}, state.formState.errors, {
|
|
@@ -2639,9 +2653,9 @@ const sendFormDataToServer = async (url, data) => {
|
|
|
2639
2653
|
});
|
|
2640
2654
|
}
|
|
2641
2655
|
return {
|
|
2656
|
+
error,
|
|
2642
2657
|
success: false,
|
|
2643
|
-
formErrors
|
|
2644
|
-
error
|
|
2658
|
+
formErrors
|
|
2645
2659
|
};
|
|
2646
2660
|
}
|
|
2647
2661
|
};
|
|
@@ -2736,7 +2750,6 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2736
2750
|
onChangeFormValues,
|
|
2737
2751
|
onSubmit
|
|
2738
2752
|
} = props;
|
|
2739
|
-
console.log(buttonJustifyContent);
|
|
2740
2753
|
const validate = useYupValidationSchema(validationSchema, language);
|
|
2741
2754
|
const onRefFormInstance = React.useCallback(formInstance => {
|
|
2742
2755
|
if (ref) {
|
|
@@ -3109,7 +3122,7 @@ const getErrorsForFinalForm = error => {
|
|
|
3109
3122
|
*/
|
|
3110
3123
|
|
|
3111
3124
|
const formErrors = {};
|
|
3112
|
-
const serverErrors = error.response?.data;
|
|
3125
|
+
const serverErrors = error.response?.data || error;
|
|
3113
3126
|
if (serverErrors) {
|
|
3114
3127
|
// Collect errors for some fields, which in the response from server
|
|
3115
3128
|
if (typeof serverErrors === 'string') {
|
package/dist/itcase-forms.esm.js
CHANGED
|
@@ -468,6 +468,7 @@ const FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(pro
|
|
|
468
468
|
thumbColumn,
|
|
469
469
|
isPreviews,
|
|
470
470
|
onAddFiles,
|
|
471
|
+
onClickPreview,
|
|
471
472
|
onDeleteFile
|
|
472
473
|
} = props;
|
|
473
474
|
|
|
@@ -650,6 +651,9 @@ const FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(pro
|
|
|
650
651
|
}, /*#__PURE__*/React.createElement("img", {
|
|
651
652
|
className: "form-dropzone__thumb-image-inner",
|
|
652
653
|
src: file.preview || file.image,
|
|
654
|
+
onClick: event => {
|
|
655
|
+
onClickPreview && onClickPreview(file, event);
|
|
656
|
+
},
|
|
653
657
|
onLoad: () => {
|
|
654
658
|
// Revoke data uri after image is loaded
|
|
655
659
|
URL.revokeObjectURL(file.preview);
|
|
@@ -809,6 +813,7 @@ const FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
809
813
|
isPreviews,
|
|
810
814
|
isRequired,
|
|
811
815
|
onAddFiles,
|
|
816
|
+
onClickPreview,
|
|
812
817
|
onDeleteFile
|
|
813
818
|
} = props;
|
|
814
819
|
const propsGenerator = useDevicePropsGenerator(props);
|
|
@@ -943,6 +948,7 @@ const FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
943
948
|
thumbNameTextWrap: thumbNameTextWrap,
|
|
944
949
|
isPreviews: isPreviews,
|
|
945
950
|
onAddFiles: onAddFiles,
|
|
951
|
+
onClickPreview: onClickPreview,
|
|
946
952
|
onDeleteFile: onDeleteFile
|
|
947
953
|
}));
|
|
948
954
|
});
|
|
@@ -1368,8 +1374,8 @@ const FormFieldCode = /*#__PURE__*/React.memo(function FormFieldCode(props) {
|
|
|
1368
1374
|
const {
|
|
1369
1375
|
name,
|
|
1370
1376
|
initialValue,
|
|
1371
|
-
messageType,
|
|
1372
1377
|
label,
|
|
1378
|
+
messageType,
|
|
1373
1379
|
isDisabled,
|
|
1374
1380
|
classNameGroupItem,
|
|
1375
1381
|
fieldProps = {},
|
|
@@ -1422,9 +1428,9 @@ const FormFieldCode = /*#__PURE__*/React.memo(function FormFieldCode(props) {
|
|
|
1422
1428
|
isValidState: isValidState
|
|
1423
1429
|
}, fieldProps), /*#__PURE__*/React.createElement(Code, Object.assign({
|
|
1424
1430
|
name: input.name,
|
|
1431
|
+
initialValue: input.value,
|
|
1425
1432
|
isDisabled: isDisabled,
|
|
1426
1433
|
autoComplete: "nope",
|
|
1427
|
-
value: input.value,
|
|
1428
1434
|
onBlur: input.onBlur,
|
|
1429
1435
|
onChange: input.onChange,
|
|
1430
1436
|
onFocus: input.onFocus
|
|
@@ -2226,9 +2232,9 @@ const FormFieldMaskedInput = /*#__PURE__*/React.memo(function FormFieldMaskedInp
|
|
|
2226
2232
|
|
|
2227
2233
|
const {
|
|
2228
2234
|
ref,
|
|
2235
|
+
setUnmaskedValue,
|
|
2229
2236
|
unmaskedValue,
|
|
2230
|
-
value
|
|
2231
|
-
setUnmaskedValue
|
|
2237
|
+
value
|
|
2232
2238
|
} = useIMask(optionsMask, {
|
|
2233
2239
|
onAccept: (newValue, event, element) => {
|
|
2234
2240
|
if (element) {
|
|
@@ -2241,6 +2247,11 @@ const FormFieldMaskedInput = /*#__PURE__*/React.memo(function FormFieldMaskedInp
|
|
|
2241
2247
|
setUnmaskedValue(input.value.replace(unmasked, ''));
|
|
2242
2248
|
}
|
|
2243
2249
|
}, [input.value]);
|
|
2250
|
+
useEffect(() => {
|
|
2251
|
+
if (unmaskedValue !== input.value) {
|
|
2252
|
+
input.onChange(unmaskedValue);
|
|
2253
|
+
}
|
|
2254
|
+
}, [unmaskedValue]);
|
|
2244
2255
|
const {
|
|
2245
2256
|
errorKey,
|
|
2246
2257
|
errorMessage,
|
|
@@ -2582,6 +2593,9 @@ const setErrorsMutator = (args, state) => {
|
|
|
2582
2593
|
// state.formState.valid = false
|
|
2583
2594
|
state.formState.error = fieldError;
|
|
2584
2595
|
state.formState.submitError = submitError;
|
|
2596
|
+
console.log('non_field_errors');
|
|
2597
|
+
console.log(data);
|
|
2598
|
+
console.log('non_field_errors');
|
|
2585
2599
|
} else if (fieldName in state.fields) {
|
|
2586
2600
|
if (fieldError) {
|
|
2587
2601
|
const errorsState = Object.assign({}, state.formState.errors, {
|
|
@@ -2628,9 +2642,9 @@ const sendFormDataToServer = async (url, data) => {
|
|
|
2628
2642
|
});
|
|
2629
2643
|
}
|
|
2630
2644
|
return {
|
|
2645
|
+
error,
|
|
2631
2646
|
success: false,
|
|
2632
|
-
formErrors
|
|
2633
|
-
error
|
|
2647
|
+
formErrors
|
|
2634
2648
|
};
|
|
2635
2649
|
}
|
|
2636
2650
|
};
|
|
@@ -2725,7 +2739,6 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
|
|
|
2725
2739
|
onChangeFormValues,
|
|
2726
2740
|
onSubmit
|
|
2727
2741
|
} = props;
|
|
2728
|
-
console.log(buttonJustifyContent);
|
|
2729
2742
|
const validate = useYupValidationSchema(validationSchema, language);
|
|
2730
2743
|
const onRefFormInstance = useCallback(formInstance => {
|
|
2731
2744
|
if (ref) {
|
|
@@ -3098,7 +3111,7 @@ const getErrorsForFinalForm = error => {
|
|
|
3098
3111
|
*/
|
|
3099
3112
|
|
|
3100
3113
|
const formErrors = {};
|
|
3101
|
-
const serverErrors = error.response?.data;
|
|
3114
|
+
const serverErrors = error.response?.data || error;
|
|
3102
3115
|
if (serverErrors) {
|
|
3103
3116
|
// Collect errors for some fields, which in the response from server
|
|
3104
3117
|
if (typeof serverErrors === 'string') {
|