diff --git a/src/components/charts/PlotConfigurator.vue b/src/components/charts/PlotConfigurator.vue index 8fc560cc..86f9546e 100644 --- a/src/components/charts/PlotConfigurator.vue +++ b/src/components/charts/PlotConfigurator.vue @@ -73,7 +73,7 @@ @indicator-selected="addNewIndicatorSelected" /> - + -const { plotTemplateNames, applyPlotTemplate } = usePlotTemplates(); - const visible = defineModel('visible'); +defineProps<{ + columns: string[]; +}>(); +const { plotTemplateNames, applyPlotTemplate, getTemplateContent } = usePlotTemplates(); const plotStore = usePlotConfigStore(); function fromTemplateApply() { if (selTemplateName.value) { plotStore.editablePlotConfig = { - ...applyPlotTemplate(selTemplateName.value, plotStore.editablePlotConfig), + ...applyPlotTemplate(selTemplateName.value, plotStore.editablePlotConfig, indicatorMap.value), }; visible.value = false; } } + +function clickStartUseTemplate() { + showIndicatorMapping.value = !showIndicatorMapping.value; + + indicatorMap.value = plotConfigColumns(getTemplateContent(selTemplateName.value)).reduce( + (acc, indicator) => { + acc[indicator] = indicator; + return acc; + }, + {}, + ); +} + const selTemplateName = ref(''); watch( () => visible.value, (v) => { if (v) { selTemplateName.value = ''; + showIndicatorMapping.value = false; } }, ); + +const indicatorMap = ref>({}); +const showIndicatorMapping = ref(false);