@dartech/arsenal-ui 1.3.35 → 1.3.37

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
@@ -639,11 +639,11 @@ const ControlRadio = ({
639
639
  value: value,
640
640
  onChange: customOnChange ? customOnChange : onChange
641
641
  }, {
642
- children: _values.map(item => jsx(FormControlLabel, {
642
+ children: _values.map((item, i) => jsx(FormControlLabel, {
643
643
  value: getValue(item),
644
644
  control: jsx(Radio, {}),
645
645
  label: getLabel(item)
646
- }))
646
+ }, i))
647
647
  })), !hideErrorMessage && (error === null || error === void 0 ? void 0 : error.message) && jsx(FormHelperText, {
648
648
  children: error.message
649
649
  })]
@@ -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
- setValue(name, value);
3553
- if (_validate) {
3554
- try {
3555
- JSON.parse(value);
3556
- clearErrors(name);
3557
- } catch (err) {
3558
- setError(name, {
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, {
@@ -3979,7 +3977,8 @@ const PropertyFiller = ({
3979
3977
  hideErrorMessage: true
3980
3978
  }), fillOption === 'json_notvalid' && jsx(JsonEditor$1, {
3981
3979
  name: name,
3982
- inputRef: ref
3980
+ inputRef: ref,
3981
+ useParsedValue: true
3983
3982
  }), fillOption === 'widget' && jsx(PropertyWidget, {
3984
3983
  property: property,
3985
3984
  name: name,
@@ -4205,7 +4204,8 @@ const MultiplePropertyFiller = ({
4205
4204
  })), fillOption === 'json_valid' && jsx(JsonEditor$1, {
4206
4205
  validate: true,
4207
4206
  name: name,
4208
- inputRef: ref
4207
+ inputRef: ref,
4208
+ useParsedValue: true
4209
4209
  }), fillOption === 'widget' && jsx(MultiplePropertyWidget$1, {
4210
4210
  property: property,
4211
4211
  name: name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.3.35",
3
+ "version": "1.3.37",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -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;