feat(expressionWidget): don't auto convert string to other type

This commit is contained in:
Bowen Tan 2022-08-01 18:26:39 +08:00
parent 8bab7855a9
commit 2e1f012698
2 changed files with 1 additions and 11 deletions

View File

@ -43,7 +43,6 @@ export const ArrayField: React.FC<WidgetProps<ArrayFieldWidgetType>> = props =>
overrideScope: true,
fallbackWhenError: exp => exp,
});
console.log('evaledValue', evaledValue);
if (!Array.isArray(evaledValue)) {
return (
<div>
@ -54,7 +53,6 @@ export const ArrayField: React.FC<WidgetProps<ArrayFieldWidgetType>> = props =>
value = evaledValue;
}
const isNotBaseType = itemSpec.type === 'object' || itemSpec.type === 'array';
return isNotBaseType ? (

View File

@ -213,14 +213,6 @@ export const ExpressionWidget: React.FC<WidgetProps<ExpressionWidgetType>> = pro
const onFocus = useCallback(() => {
evalCode(code);
}, [code, evalCode]);
const onBlur = useCallback(
newCode => {
const newValue = getParsedValue(newCode, type);
onChange(newValue);
},
[type, onChange]
);
useEffect(() => {
setDefs([customTreeTypeDefCreator(stateManager.store)]);
@ -241,7 +233,7 @@ export const ExpressionWidget: React.FC<WidgetProps<ExpressionWidgetType>> = pro
error={error}
defs={defs}
onChange={onCodeChange}
onBlur={onBlur}
onBlur={onChange}
onFocus={onFocus}
/>
);