diff --git a/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Aggregators.js b/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Aggregators.js index eef87e41b..9884f8164 100644 --- a/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Aggregators.js +++ b/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Aggregators.js @@ -9,6 +9,19 @@ export default { FormInput, ReportAggregator, }, + provide() { + return { + defaultAggregatorIndex: Vue.computed({ + get: () => this.defaultAggregatorIndex, + set: v => { + const curr = this.modelValue.find(agg => agg.default); + if (curr) + delete curr.default; + this.modelValue[v].default = true; + }, + }), + }; + }, props: { modelValue: { type: Object, @@ -24,17 +37,9 @@ export default { }; }, computed: { - aggregatorDefault: { - get() { - return this.modelValue.findIndex(agg => agg.default); - }, - set(v) { - const curr = this.modelValue.find(agg => agg.default); - if (curr) - delete curr.default; - this.modelValue[v].default = true; - }, - }, + defaultAggregatorIndex() { + return this.modelValue.findIndex(agg => agg.default); + } }, methods: { addAggregator() { @@ -45,6 +50,16 @@ export default { evt.preventDefault(); } }, + getHeaderStyle(isDefault) { + if (!isDefault) + return undefined; + return { + '--bs-accordion-btn-bg': 'var(--bs-success-bg-subtle)', + '--bs-accordion-btn-color': 'var(--bs-success-text-emphasis)', + '--bs-accordion-active-bg': 'var(--bs-success)', + '--bs-accordion-active-color': '#fff', + }; + }, }, created() { this.myId = counter++; @@ -62,7 +77,10 @@ export default { :key="i" class="accordion-item" > -