-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathWguAppTemplate.vue
More file actions
140 lines (125 loc) · 4.53 KB
/
WguAppTemplate.vue
File metadata and controls
140 lines (125 loc) · 4.53 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<template>
<v-app id="wgu-app" data-app :class="{ 'wgu-app': true, 'wgu-app-embedded': isEmbedded }">
<slot name="wgu-app-begin" />
<wgu-app-header :color="baseColor">
<!-- forward the slots of AppHeader -->
<slot name="wgu-tb-start" slot="wgu-tb-start" />
<slot name="wgu-tb-after-title" slot="wgu-tb-after-title" />
<slot name="wgu-tb-before-auto-buttons" slot="wgu-tb-before-auto-buttons" />
<slot name="wgu-tb-after-auto-buttons" slot="wgu-tb-after-auto-buttons" />
<slot name="wgu-tb-end" slot="wgu-tb-end" />
</wgu-app-header>
<slot name="wgu-after-header" />
<wgu-app-logo />
<slot name="wgu-before-content" />
<v-content>
<v-container id="ol-map-container" fluid fill-height style="padding: 0">
<wgu-map :color="baseColor" />
<!-- layer loading indicator -->
<wgu-maploading-status :color="baseColor" />
<slot name="wgu-after-map" />
</v-container>
</v-content>
<template v-for="(moduleWin, index) in moduleWins">
<component
:is="moduleWin.type" :key="index" :ref="moduleWin.type"
:color="baseColor"
:draggable="moduleWin.draggable"
:initPos="moduleWin.initPos"
:width="moduleWin.width"
:title="moduleWin.title"
:icon="moduleWin.icon"
/>
</template>
<slot name="wgu-before-footer" />
<wgu-app-footer
:color="baseColor"
:footerTextLeft="footerTextLeft"
:footerTextRight="footerTextRight"
:showCopyrightYear="showCopyrightYear"
/>
<slot name="wgu-after-footer" />
<slot name="wgu-app-end" />
</v-app>
</template>
<script>
import Vue from 'vue'
import { WguEventBus } from './WguEventBus'
import OlMap from './components/ol/Map'
import AppHeader from './components/AppHeader'
import AppFooter from './components/AppFooter'
import AppLogo from './components/AppLogo'
import MeasureWin from './components/measuretool/MeasureWin'
import LayerListWin from './components/layerlist/LayerListWin'
import InfoClickWin from './components/infoclick/InfoClickWin'
import MapLoadingStatus from './components/progress/MapLoadingStatus'
import FeatureInfoWindow from './components/FeatureInfoWindow'
export default {
name: 'wgu-app-tpl',
components: {
'wgu-map': OlMap,
'wgu-app-header': AppHeader,
'wgu-app-footer': AppFooter,
'wgu-app-logo': AppLogo,
'wgu-measuretool-win': MeasureWin,
'wgu-layerlist-win': LayerListWin,
'wgu-infoclick-win': InfoClickWin,
'wgu-maploading-status': MapLoadingStatus,
'wgu-feature-info-window-win': FeatureInfoWindow
},
data () {
return {
isEmbedded: false,
moduleWins: this.getModuleWinData(),
footerTextLeft: Vue.prototype.$appConfig.footerTextLeft,
footerTextRight: Vue.prototype.$appConfig.footerTextRight,
showCopyrightYear: Vue.prototype.$appConfig.showCopyrightYear,
baseColor: Vue.prototype.$appConfig.baseColor
}
},
mounted () {
// apply the isEmbedded state to the member var
this.isEmbedded = this.$isEmbedded;
// make the refs (floating module window, which are not connected to their
// related components, e.g. buttons to toggle them)
const refs = this.$refs;
let cmpLookup = {};
for (const key of Object.keys(refs)) {
cmpLookup[key] = refs[key][0];
}
Vue.prototype.cmpLookup = cmpLookup;
// inform registered cmps that the app is mounted and the dynamic
// components are available
WguEventBus.$emit('app-mounted');
},
methods: {
/**
* Determines the module window configuration objects from app-config:
* moduleWins: [
* {type: 'wgu-layerlist-win'},
* {type: 'wgu-measuretool-win'}
* ]
* @return {Array} module window configuration objects
*/
getModuleWinData () {
const appConfig = Vue.prototype.$appConfig || {};
const modulesConfs = appConfig.modules || {};
let moduleWins = [];
for (const key of Object.keys(modulesConfs)) {
const moduleOpts = appConfig.modules[key];
if (moduleOpts.win === true) {
moduleWins.push({
type: key + '-win',
draggable: moduleOpts.draggable,
initPos: moduleOpts.initPos,
title: moduleOpts.title,
width: moduleOpts.width,
icon: moduleOpts.icon
});
}
}
return moduleWins;
}
}
}
</script>