letalkui 0.0.4 → 0.0.5
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/package.json +1 -1
- package/src/components/JsonEditor/index.tsx +12 -3
- package/src/index.ts +2 -0
package/package.json
CHANGED
|
@@ -36,8 +36,17 @@ export const JsonEditor: React.FC<JsonEditorProps> = (props) => {
|
|
|
36
36
|
const [jsonData, setJsonData] = useState<string>(stringifyValue)
|
|
37
37
|
const [loadingSaveJson, setLoadingSaveJson] = useState<boolean>(false)
|
|
38
38
|
|
|
39
|
-
const currentError: boolean = validation[INPUT_NAME] ?? error
|
|
40
|
-
|
|
39
|
+
const currentError: boolean = Boolean(validation[INPUT_NAME]) ?? error
|
|
40
|
+
|
|
41
|
+
const currentHelperText = (): string => {
|
|
42
|
+
if (INPUT_NAME in validation) {
|
|
43
|
+
if (helperText) return helperText
|
|
44
|
+
|
|
45
|
+
return "Ocorreu um erro inesperado. Por favor, tente novamente mais tarde."
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return "Ocorreu um erro inesperado. Por favor, tente novamente mais tarde."
|
|
49
|
+
}
|
|
41
50
|
|
|
42
51
|
const handleChange = (newValue: string) => {
|
|
43
52
|
clearValidation(INPUT_NAME)
|
|
@@ -70,7 +79,7 @@ export const JsonEditor: React.FC<JsonEditorProps> = (props) => {
|
|
|
70
79
|
value={value}
|
|
71
80
|
onChange={handleChange}
|
|
72
81
|
currentError={currentError}
|
|
73
|
-
currentHelperText={currentHelperText}
|
|
82
|
+
currentHelperText={currentHelperText()}
|
|
74
83
|
/>
|
|
75
84
|
|
|
76
85
|
<JsonForm.ActionsButtons>
|
package/src/index.ts
CHANGED