@dartech/arsenal-ui 1.3.36 → 1.3.38
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/index.js
CHANGED
@@ -3536,7 +3536,8 @@ const PropertyAdditionalFields = ({
|
|
3536
3536
|
const JsonEditor = ({
|
3537
3537
|
validate: _validate = false,
|
3538
3538
|
name,
|
3539
|
-
inputRef
|
3539
|
+
inputRef,
|
3540
|
+
useParsedValue
|
3540
3541
|
}) => {
|
3541
3542
|
const {
|
3542
3543
|
control,
|
@@ -3549,16 +3550,13 @@ const JsonEditor = ({
|
|
3549
3550
|
name
|
3550
3551
|
});
|
3551
3552
|
const handleChange = value => {
|
3552
|
-
|
3553
|
-
|
3554
|
-
|
3555
|
-
|
3556
|
-
|
3557
|
-
|
3558
|
-
|
3559
|
-
message: 'Invalid JSON'
|
3560
|
-
});
|
3561
|
-
}
|
3553
|
+
try {
|
3554
|
+
if (value) setValue(name, useParsedValue ? JSON.parse(value) : value);
|
3555
|
+
clearErrors(name);
|
3556
|
+
} catch (e) {
|
3557
|
+
if (_validate) setError(name, {
|
3558
|
+
message: 'Invalid JSON'
|
3559
|
+
});
|
3562
3560
|
}
|
3563
3561
|
};
|
3564
3562
|
return jsx(CodeMirror, {
|
@@ -4205,7 +4203,8 @@ const MultiplePropertyFiller = ({
|
|
4205
4203
|
})), fillOption === 'json_valid' && jsx(JsonEditor$1, {
|
4206
4204
|
validate: true,
|
4207
4205
|
name: name,
|
4208
|
-
inputRef: ref
|
4206
|
+
inputRef: ref,
|
4207
|
+
useParsedValue: true
|
4209
4208
|
}), fillOption === 'widget' && jsx(MultiplePropertyWidget$1, {
|
4210
4209
|
property: property,
|
4211
4210
|
name: name,
|
package/package.json
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { RefCallBack } from 'react-hook-form';
|
3
3
|
type Props = {
|
4
|
+
useParsedValue?: boolean;
|
4
5
|
validate?: boolean;
|
5
6
|
name: string;
|
6
7
|
inputRef: RefCallBack;
|
7
8
|
};
|
8
|
-
declare const JsonEditor: ({ validate, name, inputRef }: Props) => JSX.Element;
|
9
|
+
declare const JsonEditor: ({ validate, name, inputRef, useParsedValue }: Props) => JSX.Element;
|
9
10
|
export default JsonEditor;
|