@fovestta2/web-react 1.2.1 → 1.2.3
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/components/AddUpdateForm.d.ts +9 -0
- package/dist/components/AddUpdateForm.js +458 -89
- package/dist/components/FvDropdown.js +17 -16
- package/dist/components/FvEmailField.js +12 -14
- package/dist/components/FvEntryField.js +12 -17
- package/dist/components/FvMasterScreen.d.ts +78 -0
- package/dist/components/FvMasterScreen.js +317 -0
- package/dist/components/FvNumberField.js +12 -16
- package/dist/components/FvPasswordField.js +12 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +3 -3
|
@@ -27,27 +27,20 @@ exports.FvPasswordField = void 0;
|
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const validation_engine_1 = require("@fovestta2/validation-engine");
|
|
29
29
|
const FvPasswordField = ({ label = 'Password', placeholder = '••••••••', value, schema, disabled = false, readonly = false, className = '', inputClassName = '', labelClassName = '', errorClassName = '', onChange, onBlur, onFocus, }) => {
|
|
30
|
-
const [
|
|
30
|
+
const [isTouched, setIsTouched] = (0, react_1.useState)(false);
|
|
31
31
|
const [showPassword, setShowPassword] = (0, react_1.useState)(false);
|
|
32
|
-
(0, react_1.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (!result.isValid && result.errorKey) {
|
|
40
|
-
setErrorMessage(result.errorKey);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
setErrorMessage(null);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
32
|
+
const errorMessage = (0, react_1.useMemo)(() => {
|
|
33
|
+
if (!isTouched || !schema)
|
|
34
|
+
return null;
|
|
35
|
+
const result = validation_engine_1.Validator.validate(value, schema);
|
|
36
|
+
return result.isValid ? null : (result.message || result.errorKey);
|
|
37
|
+
}, [value, schema, isTouched]);
|
|
38
|
+
// Sync logic removed in favor of useMemo
|
|
46
39
|
const handleInput = (e) => {
|
|
47
40
|
onChange(e.target.value);
|
|
48
41
|
};
|
|
49
42
|
const handleBlur = (e) => {
|
|
50
|
-
|
|
43
|
+
setIsTouched(true);
|
|
51
44
|
if (onBlur)
|
|
52
45
|
onBlur();
|
|
53
46
|
};
|
|
@@ -76,6 +69,9 @@ const FvPasswordField = ({ label = 'Password', placeholder = '••••••
|
|
|
76
69
|
ERR_PASSWORD_MISSING_LOWERCASE: 'Lowercase letter missing',
|
|
77
70
|
ERR_PASSWORD_MISSING_NUMBER: 'At least one number missing',
|
|
78
71
|
ERR_PASSWORD_MISSING_SPECIAL_CHAR: 'Special character missing',
|
|
72
|
+
ERR_MIN_VALUE: 'Value is too small',
|
|
73
|
+
ERR_MAX_VALUE: 'Value is too large',
|
|
74
|
+
ERR_CUSTOM_INVALID: 'Invalid value',
|
|
79
75
|
};
|
|
80
76
|
return errorMessages[errorMessage] || errorMessage;
|
|
81
77
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -45,3 +45,4 @@ Object.defineProperty(exports, "FvDocumentField", { enumerable: true, get: funct
|
|
|
45
45
|
__exportStar(require("./components/FvRichTextEditor"), exports);
|
|
46
46
|
__exportStar(require("./components/AddUpdateForm"), exports);
|
|
47
47
|
__exportStar(require("./components/QueryForm"), exports);
|
|
48
|
+
__exportStar(require("./components/FvMasterScreen"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fovestta2/web-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"react-dom": ">=18.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@fovestta2/validation-engine": "^1.2.
|
|
28
|
+
"@fovestta2/validation-engine": "^1.2.3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/react": "^18.2.0",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"files": [
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "4a124b94929ae898505ed77eae348300e2f507b1"
|
|
39
39
|
}
|