직접입력값 평가오류 수정
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
setConditionRightPeriod,
|
||||
setConditionThreshold,
|
||||
setConditionValuePeriod,
|
||||
canonicalizeConditionThreshold,
|
||||
usesValuePeriodField,
|
||||
} from '../../utils/conditionPeriods';
|
||||
import { compositeDisplayName, compositeElementLabel, COMPOSITE_INDICATOR_ITEMS, switchCompositeIndicatorType } from '../../utils/compositeIndicators';
|
||||
@@ -168,7 +169,11 @@ export default function ConditionNodeSettings({
|
||||
min={thresholdBounds.min}
|
||||
max={thresholdBounds.max}
|
||||
allowDecimal
|
||||
onChange={v => onChange(setConditionThreshold(condition, 'right', v, def, { directInput: true }))}
|
||||
onChange={v => onChange(
|
||||
canonicalizeConditionThreshold(
|
||||
setConditionThreshold(condition, 'right', v, def, { directInput: true }),
|
||||
),
|
||||
)}
|
||||
/>
|
||||
</label>
|
||||
</>
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
import '@xyflow/react/dist/style.css';
|
||||
import type { Theme } from '../../types/index';
|
||||
import type { LogicNode, ConditionDSL } from '../../utils/strategyTypes';
|
||||
import { normalizeConditionForPersistence } from '../../utils/strategyConditionNormalize';
|
||||
import {
|
||||
addChild,
|
||||
deleteNode,
|
||||
@@ -716,21 +717,22 @@ function StrategyEditorCanvasInner({
|
||||
}, [clearDropPreview, applyDropWithAttach, addOrphanAt, root, orphans]);
|
||||
|
||||
const handleUpdateCondition = useCallback((id: string, condition: ConditionDSL) => {
|
||||
const next = normalizeConditionForPersistence(condition);
|
||||
if (isOrphanNode(orphans, id)) {
|
||||
onOrphansChange(orphans.map(o => (
|
||||
o.id === id ? { ...o, condition } : o
|
||||
o.id === id ? { ...o, condition: next } : o
|
||||
)));
|
||||
return;
|
||||
}
|
||||
if (root && findNodeInTree(root, id)) {
|
||||
onChange(updateNode(root, id, n => ({ ...n, condition })));
|
||||
onChange(updateNode(root, id, n => ({ ...n, condition: next })));
|
||||
return;
|
||||
}
|
||||
for (const [sid, branch] of Object.entries(extraRoots)) {
|
||||
if (branch && findNodeInTree(branch, id)) {
|
||||
onExtraRootsChange?.({
|
||||
...extraRoots,
|
||||
[sid]: updateNode(branch, id, n => ({ ...n, condition })),
|
||||
[sid]: updateNode(branch, id, n => ({ ...n, condition: next })),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user