지표탭 추가

This commit is contained in:
Macbook
2026-05-27 09:32:26 +09:00
parent d0985f8f0f
commit 8876dbd752
12 changed files with 595 additions and 73 deletions
+10
View File
@@ -32,6 +32,7 @@ import {
mergeIndicators,
reorderIndicatorGroup,
splitIndicatorPane,
buildIndicatorConfigsFromTypes,
} from '../utils/indicatorPaneMerge';
import { saveSlot } from '../utils/backendApi';
import type {
@@ -85,6 +86,8 @@ function newIndId() { return `sind_${++_slotIndCounter}_${Date.now()}`; }
export interface ChartSlotHandle {
/** 지표 추가 */
addIndicator: (type: string, fromConfig?: IndicatorConfig) => void;
/** 지표 일괄 추가 (탭 전체 추가) */
addIndicators: (types: string[]) => void;
/** 지표 제거 (type 기준) */
removeIndicatorByType: (type: string) => void;
/** 보조지표 pane 복사 */
@@ -268,6 +271,13 @@ const ChartSlot = forwardRef<ChartSlotHandle, ChartSlotProps>(function ChartSlot
return [...prev, cfg];
});
},
addIndicators: (types: string[]) => {
if (!types.length) return;
setIndicators(prev => {
const added = buildIndicatorConfigsFromTypes(types, prev, getParams, getVisualConfig, newIndId);
return added.length > 0 ? [...prev, ...added] : prev;
});
},
removeIndicatorByType: (type: string) => {
setIndicators(prev => prev.filter(i => i.type !== type));
},