1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
<!--
Matomo - free/libre analytics platform
@link https://matomo.org
@license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
-->
<template>
<div>
<div
v-for="(widget, index) in actualContainer"
:key="index"
>
<div>
<Widget
:widget="widget"
:prevent-recursion="true"
/>
</div>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import useExternalPluginComponent from '../useExternalPluginComponent';
import { WidgetData } from '../Widget/Widgets.store';
// since we're recursing, don't import the plugin directly
const Widget = useExternalPluginComponent('CoreHome', 'Widget');
export default defineComponent({
props: {
container: Array,
},
components: {
Widget,
},
computed: {
actualContainer() {
const { container }: { container: WidgetData[] } = this;
if (!container?.[0]?.parameters) {
return container;
}
const [widget] = container;
const isWidgetized = widget.parameters.widget === '1' || widget.parameters.widget === 1;
const isGraphEvolution = isWidgetized && widget.viewDataTable === 'graphEvolution';
// we hide the first title for Visits Overview with Graph and Goal Overview
const firstWidget = isGraphEvolution
? { ...widget, parameters: { ...widget.parameters, showtitle: '0' } }
: widget;
return [
firstWidget,
...container.slice(1),
];
},
},
});
</script>
|