@dartech/arsenal-ui 1.3.62 → 1.3.63
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
@@ -1214,22 +1214,10 @@ const JsonView = ({
|
|
1214
1214
|
height: _height = '200px',
|
1215
1215
|
fontSize: _fontSize = 16
|
1216
1216
|
}) => {
|
1217
|
-
const stringValue = useMemo(() => {
|
1218
|
-
if (typeof value === 'string') {
|
1219
|
-
return value;
|
1220
|
-
} else if (typeof value === 'object') {
|
1221
|
-
try {
|
1222
|
-
return JSON.stringify(value, null, 2);
|
1223
|
-
} catch (error) {
|
1224
|
-
return 'Failed to stringify Object';
|
1225
|
-
}
|
1226
|
-
}
|
1227
|
-
return '';
|
1228
|
-
}, [value]);
|
1229
1217
|
return jsx(CodeMirror, {
|
1230
1218
|
readOnly: true,
|
1231
1219
|
width: "100%",
|
1232
|
-
value:
|
1220
|
+
value: typeof value === 'string' ? value : JSON.stringify(value, null, 2),
|
1233
1221
|
height: _height,
|
1234
1222
|
basicSetup: {
|
1235
1223
|
autocompletion: true,
|
@@ -3715,17 +3703,16 @@ const PropertyWidget = ({
|
|
3715
3703
|
});
|
3716
3704
|
// return <JsonEditor validate name={name} ref={ref} useParsedValue />;
|
3717
3705
|
case PropertyType.STRING:
|
3718
|
-
return jsx(StringValueField$1
|
3719
|
-
// required={!property.isRequired}
|
3720
|
-
, {
|
3721
|
-
// required={!property.isRequired}
|
3706
|
+
return jsx(StringValueField$1, {
|
3722
3707
|
name: name,
|
3723
3708
|
label: label,
|
3724
3709
|
restrictedValues: property.restrictedValues
|
3725
3710
|
});
|
3726
3711
|
case PropertyType.ENTITY_REFERENCE:
|
3727
|
-
return jsx(ControlInput
|
3728
|
-
|
3712
|
+
return jsx(ControlInput
|
3713
|
+
// required
|
3714
|
+
, {
|
3715
|
+
// required
|
3729
3716
|
hideErrorMessage: true,
|
3730
3717
|
name: name,
|
3731
3718
|
label: label,
|
@@ -3803,7 +3790,7 @@ const usePropertyFiller = ({
|
|
3803
3790
|
const checkFillOption = useCallback(() => {
|
3804
3791
|
if (isExpression(value) && fillOption !== 'expression') {
|
3805
3792
|
setFillOption('expression');
|
3806
|
-
} else if (value !== null && value !== undefined && !isExpression(value) && fillOption !== 'widget') {
|
3793
|
+
} else if (value !== null && value !== undefined && !isExpression(value) && fillOption !== 'widget' && fillOption !== 'string') {
|
3807
3794
|
setFillOption('widget');
|
3808
3795
|
}
|
3809
3796
|
}, [value, fillOption]);
|
@@ -3868,7 +3855,10 @@ const PropertyFiller = ({
|
|
3868
3855
|
control,
|
3869
3856
|
defaultValue: property.defaultValue,
|
3870
3857
|
rules: {
|
3871
|
-
|
3858
|
+
validate: val => {
|
3859
|
+
if (required && val === null) return 'Please, fill this field555';
|
3860
|
+
return true;
|
3861
|
+
}
|
3872
3862
|
}
|
3873
3863
|
});
|
3874
3864
|
const {
|
@@ -3921,7 +3911,6 @@ const PropertyFiller = ({
|
|
3921
3911
|
setValue(name, definitionValue);
|
3922
3912
|
} catch (error) {
|
3923
3913
|
setValue(name, defaultArrayValue);
|
3924
|
-
// console.log('Parse failed');
|
3925
3914
|
}
|
3926
3915
|
} else {
|
3927
3916
|
setValue(name, defaultArrayValue);
|
@@ -3935,10 +3924,10 @@ const PropertyFiller = ({
|
|
3935
3924
|
}
|
3936
3925
|
}, [isDirty, property, name, setValue]);
|
3937
3926
|
useEffect(() => {
|
3938
|
-
if (property.isRequired && !
|
3927
|
+
if (value === undefined || property.isRequired && value === null && !property.defaultValue) {
|
3939
3928
|
setValue(name, defaultProperyValue);
|
3940
3929
|
}
|
3941
|
-
}, [value, setValue, defaultProperyValue, property, name
|
3930
|
+
}, [value, setValue, defaultProperyValue, property, name]);
|
3942
3931
|
return jsxs(Grid$1, Object.assign({
|
3943
3932
|
xs: 12
|
3944
3933
|
}, {
|
@@ -3975,9 +3964,7 @@ const PropertyFiller = ({
|
|
3975
3964
|
}), option.value))
|
3976
3965
|
}))]
|
3977
3966
|
}))
|
3978
|
-
})) : null, fillOption === 'expression' && (propertyType === PropertyType.JSON || propertyType === PropertyType.ENTITY || propertyType === PropertyType.ANY ?
|
3979
|
-
// <JsonEditor validate name={name} useParsedValue />
|
3980
|
-
jsx(ControlAceEditor, {
|
3967
|
+
})) : null, fillOption === 'expression' && (propertyType === PropertyType.JSON || propertyType === PropertyType.ENTITY || propertyType === PropertyType.ANY ? jsx(ControlAceEditor, {
|
3981
3968
|
name: name,
|
3982
3969
|
control: control,
|
3983
3970
|
label: valueLabel,
|
@@ -3988,17 +3975,13 @@ const PropertyFiller = ({
|
|
3988
3975
|
control: control,
|
3989
3976
|
name: name,
|
3990
3977
|
label: valueLabel,
|
3991
|
-
required: true,
|
3992
3978
|
hideErrorMessage: true
|
3993
3979
|
})), fillOption === 'string' && jsx(ControlInput, {
|
3994
3980
|
control: control,
|
3995
3981
|
name: name,
|
3996
3982
|
label: valueLabel,
|
3997
|
-
required: true,
|
3998
3983
|
hideErrorMessage: true
|
3999
|
-
}), fillOption === 'json_notvalid' &&
|
4000
|
-
// <JsonEditor validate name={name} />
|
4001
|
-
jsx(ControlAceEditor, {
|
3984
|
+
}), fillOption === 'json_notvalid' && jsx(ControlAceEditor, {
|
4002
3985
|
name: name,
|
4003
3986
|
control: control,
|
4004
3987
|
label: valueLabel,
|
@@ -4008,8 +3991,7 @@ const PropertyFiller = ({
|
|
4008
3991
|
property: property,
|
4009
3992
|
name: name,
|
4010
3993
|
useExpression: useExpression,
|
4011
|
-
label: valueLabel
|
4012
|
-
required: required
|
3994
|
+
label: valueLabel
|
4013
3995
|
}), fillOption === 'dem_builder' && jsx(CreateDefinition, {
|
4014
3996
|
title: "JSON",
|
4015
3997
|
definitionFieldName: name
|
package/package.json
CHANGED