지표탭 추가
This commit is contained in:
@@ -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));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user