@mixd-id/web-scaffold 0.2.240702 → 0.2.240703
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/schema/user-action.json +266 -0
- package/package.json +6 -2
- package/public/assets/dashboard/bar.png +0 -0
- package/public/assets/dashboard/doughnut.png +0 -0
- package/public/assets/dashboard/metric.png +0 -0
- package/public/assets/dashboard/pie.png +0 -0
- package/public/assets/dashboard/polar-area.png +0 -0
- package/public/assets/dashboard/virtual-table.png +0 -0
- package/public/static/dashboard/bar.png +0 -0
- package/public/static/dashboard/doughnut.png +0 -0
- package/public/static/dashboard/metric.png +0 -0
- package/public/static/dashboard/pie.png +0 -0
- package/public/static/dashboard/polar-area.png +0 -0
- package/public/static/dashboard/virtual-table.png +0 -0
- package/src/components/Button.vue +179 -160
- package/src/components/Checkbox.vue +0 -1
- package/src/components/Datepicker.vue +8 -6
- package/src/components/GHeatMaps.vue +317 -0
- package/src/components/GmapsDirection.vue +191 -0
- package/src/components/Grid.vue +2 -0
- package/src/components/HTMLEditor.vue +2 -2
- package/src/components/List.vue +384 -308
- package/src/components/Modal.vue +2 -3
- package/src/components/PresetSelectorFilterItem.vue +15 -2
- package/src/components/Switch.vue +3 -0
- package/src/components/Tabs.vue +1 -1
- package/src/components/TextWithTag.vue +67 -25
- package/src/components/Textbox.vue +5 -0
- package/src/components/VirtualGrid.vue +224 -228
- package/src/components/VirtualTable.vue +46 -28
- package/src/configs/dashboard/bar.js +10 -0
- package/src/configs/dashboard/collection-1.js +5 -0
- package/src/configs/dashboard/doughnut.js +7 -0
- package/src/configs/dashboard/gheatmaps.js +9 -0
- package/src/configs/dashboard/grid-2.js +34 -0
- package/src/configs/dashboard/grid-3.js +34 -0
- package/src/configs/dashboard/grid-4.js +34 -0
- package/src/configs/dashboard/grid.js +15 -0
- package/src/configs/dashboard/metric.js +10 -0
- package/src/configs/dashboard/pie.js +7 -0
- package/src/configs/dashboard/polar-area.js +7 -0
- package/src/configs/dashboard/virtual-table.js +9 -0
- package/src/defs/dashboard-preset.js +22 -0
- package/src/index.js +35 -23
- package/src/mixin/ready-state.js +37 -0
- package/src/stores/datasource.js +11 -0
- package/src/themes/default/index.js +1 -1
- package/src/utils/dashboard.js +1080 -0
- package/src/utils/event-bus.js +8 -0
- package/src/utils/helpers.js +56 -8
- package/src/utils/helpers.mjs +35 -1
- package/src/utils/preset-selector.js +5 -2
- package/src/utils/preset-selector.mjs +23 -13
- package/src/widgets/Dashboard/BarChart.vue +330 -0
- package/src/widgets/Dashboard/BarChartSetting.vue +317 -0
- package/src/widgets/Dashboard/DatasourceFilterSharing.vue +93 -0
- package/src/widgets/Dashboard/DatasourcePreview.vue +93 -0
- package/src/widgets/Dashboard/DatasourceSelector.vue +122 -0
- package/src/widgets/Dashboard/Doughnut.vue +157 -0
- package/src/widgets/Dashboard/DoughnutSetting.vue +196 -0
- package/src/widgets/Dashboard/GHeatMapsSetting.vue +108 -0
- package/src/widgets/Dashboard/InteractionEdit.vue +228 -0
- package/src/widgets/Dashboard/Metric.vue +76 -0
- package/src/widgets/Dashboard/MetricSetting.vue +174 -0
- package/src/widgets/Dashboard/Pie.vue +139 -0
- package/src/widgets/Dashboard/PieSetting.vue +247 -0
- package/src/widgets/Dashboard/PolarArea.vue +159 -0
- package/src/widgets/Dashboard/PolarAreaSetting.vue +195 -0
- package/src/widgets/Dashboard/SharingModal.vue +116 -0
- package/src/widgets/Dashboard/ViewSelector.vue +183 -0
- package/src/widgets/Dashboard/VirtualColumnEdit.vue +97 -0
- package/src/widgets/Dashboard/VirtualTableSetting.vue +234 -0
- package/src/widgets/Dashboard.vue +1773 -0
- package/src/widgets/PresetBar.vue +136 -175
- package/src/widgets/PresetBarPivot.vue +186 -0
- package/src/widgets/UserActionBuilder/UserActionCondition.vue +97 -0
- package/src/widgets/UserActionBuilder/UserActionConsole.vue +77 -0
- package/src/widgets/UserActionBuilder/UserActionItem.vue +163 -58
- package/src/widgets/UserActionBuilder/UserActionOutput.vue +35 -9
- package/src/widgets/UserActionBuilder/UserActionOutputDelay.vue +27 -0
- package/src/widgets/UserActionBuilder/UserActionOutputLog.vue +28 -0
- package/src/widgets/UserActionBuilder/UserActionOutputReply.vue +135 -0
- package/src/widgets/UserActionBuilder/UserActionProps.vue +211 -0
- package/src/widgets/UserActionBuilder.vue +68 -199
- package/src/widgets/WebPageBuilder4/GridSetting.vue +123 -73
- package/src/widgets/WebPageBuilder4/HeightSetting.vue +14 -11
- package/src/widgets/WebPageBuilder4/MarginSetting.vue +4 -1
- package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +12 -4
- package/src/widgets/WebPageBuilder4/PaddingSetting.vue +4 -0
- package/src/widgets/WebPageBuilder4/TreeView.vue +6 -3
- package/src/widgets/WebPageBuilder4/TreeViewItem.vue +32 -58
- package/tailwind.config.js +2 -2
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="readyState === 1" :class="$style.comp">
|
|
3
|
+
<div class="flex flex-row items-center gap-2 p-1 px-3 p-2">
|
|
4
|
+
<div class="flex-1">
|
|
5
|
+
<label class="text-text-400">{{ label }}</label>
|
|
6
|
+
</div>
|
|
7
|
+
<label class="text-sm text-text-300">Total points: {{ uniqueCount }}</label>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div v-if="apiKey" ref="map" class="flex-1">
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
<div v-else class="flex-1 flex items-center justify-center text-text-400">{{ $t('Google maps api required') }}</div>
|
|
14
|
+
|
|
15
|
+
<div class="flex flex-row">
|
|
16
|
+
|
|
17
|
+
<div class="flex-1 flex items-center justify-center divide-x divide-text-50 border-l-[1px] border-r-[1px] border-text-50">
|
|
18
|
+
<button type="button" class="p-1 px-3 hover:bg-primary text-text-400" @click="zoomOut">
|
|
19
|
+
<svg width="16" height="16" class="fill-text-500 hover:fill-text" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"/></svg>
|
|
20
|
+
</button>
|
|
21
|
+
<button type="button" class="p-1 px-3 hover:bg-primary text-text-400 hover:text-text" @click="panLeft">
|
|
22
|
+
<svg width="16" height="16" class="fill-text-500 hover:fill-text" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M137.4 406.6l-128-127.1C3.125 272.4 0 264.2 0 255.1s3.125-16.38 9.375-22.63l128-127.1c9.156-9.156 22.91-11.9 34.88-6.943S192 115.1 192 128v255.1c0 12.94-7.781 24.62-19.75 29.58S146.5 415.8 137.4 406.6z"/></svg>
|
|
23
|
+
</button>
|
|
24
|
+
<button type="button" class="p-1 px-3 hover:bg-primary text-text-400 hover:text-text" @click="panUp">
|
|
25
|
+
<svg width="16" height="16" class="fill-text-500 hover:fill-text" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M9.39 265.4l127.1-128C143.6 131.1 151.8 128 160 128s16.38 3.125 22.63 9.375l127.1 128c9.156 9.156 11.9 22.91 6.943 34.88S300.9 320 287.1 320H32.01c-12.94 0-24.62-7.781-29.58-19.75S.2333 274.5 9.39 265.4z"/></svg>
|
|
26
|
+
</button>
|
|
27
|
+
<button type="button" class="p-1 px-3 hover:bg-primary text-text-400 hover:text-text" @click="panRight">
|
|
28
|
+
<svg width="16" height="16" class="fill-text-500 hover:fill-text" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M118.6 105.4l128 127.1C252.9 239.6 256 247.8 256 255.1s-3.125 16.38-9.375 22.63l-128 127.1c-9.156 9.156-22.91 11.9-34.88 6.943S64 396.9 64 383.1V128c0-12.94 7.781-24.62 19.75-29.58S109.5 96.23 118.6 105.4z"/></svg>
|
|
29
|
+
</button>
|
|
30
|
+
<button type="button" class="p-1 px-3 hover:bg-primary text-text-400 hover:text-text" @click="panDown">
|
|
31
|
+
<svg width="16" height="16" class="fill-text-500 hover:fill-text" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M310.6 246.6l-127.1 128C176.4 380.9 168.2 384 160 384s-16.38-3.125-22.63-9.375l-127.1-128C.2244 237.5-2.516 223.7 2.438 211.8S19.07 192 32 192h255.1c12.94 0 24.62 7.781 29.58 19.75S319.8 237.5 310.6 246.6z"/></svg>
|
|
32
|
+
</button>
|
|
33
|
+
<button type="button" class="p-1 px-3 hover:bg-primary text-text-400 hover:text-text" @click="zoomIn">
|
|
34
|
+
<svg width="16" height="16" class="fill-text-500 hover:fill-text" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"/></svg>
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div v-else :class="$style.comp" class="min-h-[200px] flex items-center justify-center">
|
|
41
|
+
<label class="text-text-300">Loading...</label>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script>
|
|
46
|
+
|
|
47
|
+
import {Loader} from '@googlemaps/js-api-loader';
|
|
48
|
+
import {readyStateMixin} from "../mixin/ready-state";
|
|
49
|
+
|
|
50
|
+
let loader = null
|
|
51
|
+
|
|
52
|
+
export default{
|
|
53
|
+
|
|
54
|
+
name: "GHeatMaps",
|
|
55
|
+
|
|
56
|
+
props: {
|
|
57
|
+
column: String,
|
|
58
|
+
|
|
59
|
+
label: String,
|
|
60
|
+
|
|
61
|
+
value: Object,
|
|
62
|
+
|
|
63
|
+
apiKey: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: 'AIzaSyBmzMlmrR5St-njtN--64y_oLTa9FDLYfQ'
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
data(){
|
|
70
|
+
return {
|
|
71
|
+
map: null,
|
|
72
|
+
zoom: 4,
|
|
73
|
+
center: null,
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
mixins: [ readyStateMixin ],
|
|
78
|
+
|
|
79
|
+
mounted() {
|
|
80
|
+
this.load()
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
methods: {
|
|
84
|
+
|
|
85
|
+
load(){
|
|
86
|
+
if(!this.apiKey) return
|
|
87
|
+
if(!Array.isArray(this.datasets) || this.datasets.length < 1)
|
|
88
|
+
return
|
|
89
|
+
|
|
90
|
+
if(!loader)
|
|
91
|
+
loader = new Loader({
|
|
92
|
+
apiKey: this.apiKey // "AIzaSyBmzMlmrR5St-njtN--64y_oLTa9FDLYfQ"
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
loader.load()
|
|
96
|
+
.then(async () => {
|
|
97
|
+
|
|
98
|
+
const { Map } = await google.maps.importLibrary([ "maps" ]);
|
|
99
|
+
await google.maps.importLibrary("visualization", ["HeatmapLayer"]);
|
|
100
|
+
|
|
101
|
+
var center = new google.maps.LatLng(
|
|
102
|
+
this.center ? this.center[0] : -6.2088,
|
|
103
|
+
this.center ? this.center[1] : 106.8456);
|
|
104
|
+
|
|
105
|
+
this.map = new Map(this.$refs.map, {
|
|
106
|
+
center: center,
|
|
107
|
+
zoom: this.zoom ?? 4,
|
|
108
|
+
mapTypeId: 'roadmap',
|
|
109
|
+
streetViewControl: false,
|
|
110
|
+
keyboardShortcuts: false,
|
|
111
|
+
disableDefaultUI: true,
|
|
112
|
+
styles: [
|
|
113
|
+
{ elementType: "geometry", stylers: [{ color: "#242f3e" }] },
|
|
114
|
+
{ elementType: "labels.text.stroke", stylers: [{ color: "#242f3e" }] },
|
|
115
|
+
{ elementType: "labels.text.fill", stylers: [{ color: "#746855" }] },
|
|
116
|
+
{
|
|
117
|
+
featureType: "administrative.locality",
|
|
118
|
+
elementType: "labels.text.fill",
|
|
119
|
+
stylers: [{ color: "#d59563" }],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
featureType: "poi",
|
|
123
|
+
elementType: "labels.text.fill",
|
|
124
|
+
stylers: [{ color: "#d59563" }],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
featureType: "poi.park",
|
|
128
|
+
elementType: "geometry",
|
|
129
|
+
stylers: [{ color: "#263c3f" }],
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
featureType: "poi.park",
|
|
133
|
+
elementType: "labels.text.fill",
|
|
134
|
+
stylers: [{ color: "#6b9a76" }],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
featureType: "road",
|
|
138
|
+
elementType: "geometry",
|
|
139
|
+
stylers: [{ color: "#38414e" }],
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
featureType: "road",
|
|
143
|
+
elementType: "geometry.stroke",
|
|
144
|
+
stylers: [{ color: "#212a37" }],
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
featureType: "road",
|
|
148
|
+
elementType: "labels.text.fill",
|
|
149
|
+
stylers: [{ color: "#9ca5b3" }],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
featureType: "road.highway",
|
|
153
|
+
elementType: "geometry",
|
|
154
|
+
stylers: [{ color: "#746855" }],
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
featureType: "road.highway",
|
|
158
|
+
elementType: "geometry.stroke",
|
|
159
|
+
stylers: [{ color: "#1f2835" }],
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
featureType: "road.highway",
|
|
163
|
+
elementType: "labels.text.fill",
|
|
164
|
+
stylers: [{ color: "#f3d19c" }],
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
featureType: "transit",
|
|
168
|
+
elementType: "geometry",
|
|
169
|
+
stylers: [{ color: "#2f3948" }],
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
featureType: "transit.station",
|
|
173
|
+
elementType: "labels.text.fill",
|
|
174
|
+
stylers: [{ color: "#d59563" }],
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
featureType: "water",
|
|
178
|
+
elementType: "geometry",
|
|
179
|
+
stylers: [{ color: "#17263c" }],
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
featureType: "water",
|
|
183
|
+
elementType: "labels.text.fill",
|
|
184
|
+
stylers: [{ color: "#515c6d" }],
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
featureType: "water",
|
|
188
|
+
elementType: "labels.text.stroke",
|
|
189
|
+
stylers: [{ color: "#17263c" }],
|
|
190
|
+
},
|
|
191
|
+
]
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
google.maps.event.addListener(this.map, 'zoom_changed', () => {
|
|
195
|
+
this.zoom = this.map.getZoom();
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
google.maps.event.addListener(this.map, 'center_changed', () => {
|
|
199
|
+
this.center = [
|
|
200
|
+
this.map.getCenter().lat(),
|
|
201
|
+
this.map.getCenter().lng()
|
|
202
|
+
]
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
var heatMapData = [];
|
|
206
|
+
|
|
207
|
+
this.datasets.forEach((item) => {
|
|
208
|
+
if(item[0] && item[1] && item[2]){
|
|
209
|
+
heatMapData.push({
|
|
210
|
+
location: new google.maps.LatLng(item[0], item[1]),
|
|
211
|
+
weight: item[2]
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
var heatmap = new google.maps.visualization.HeatmapLayer({
|
|
217
|
+
data: heatMapData,
|
|
218
|
+
dissipating: true
|
|
219
|
+
});
|
|
220
|
+
heatmap.set('radius', parseInt(this.mapRadius ?? 12))
|
|
221
|
+
heatmap.setMap(this.map);
|
|
222
|
+
|
|
223
|
+
const gradient = [
|
|
224
|
+
"rgba(0, 255, 255, 0)",
|
|
225
|
+
"rgba(0, 255, 255, 1)",
|
|
226
|
+
"rgba(0, 191, 255, 1)",
|
|
227
|
+
"rgba(0, 127, 255, 1)",
|
|
228
|
+
"rgba(0, 63, 255, 1)",
|
|
229
|
+
"rgba(0, 0, 255, 1)",
|
|
230
|
+
"rgba(0, 0, 223, 1)",
|
|
231
|
+
"rgba(0, 0, 191, 1)",
|
|
232
|
+
"rgba(0, 0, 159, 1)",
|
|
233
|
+
"rgba(0, 0, 127, 1)",
|
|
234
|
+
"rgba(63, 0, 91, 1)",
|
|
235
|
+
"rgba(127, 0, 63, 1)",
|
|
236
|
+
"rgba(191, 0, 31, 1)",
|
|
237
|
+
"rgba(255, 0, 0, 1)",
|
|
238
|
+
];
|
|
239
|
+
heatmap.set("gradient", gradient);
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
zoomIn(){
|
|
244
|
+
this.map.setZoom(this.map.getZoom() + 1)
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
zoomOut(){
|
|
248
|
+
this.map.setZoom(this.map.getZoom() - 1)
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
panLeft(){
|
|
252
|
+
this.map.panBy(-50, 0);
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
panUp(){
|
|
256
|
+
this.map.panBy(0, -50);
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
panRight(){
|
|
260
|
+
this.map.panBy(50, 0);
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
panDown(){
|
|
264
|
+
this.map.panBy(0, 50);
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
computed: {
|
|
270
|
+
|
|
271
|
+
uniqueCount(){
|
|
272
|
+
if(!Array.isArray(this.value?.items)) return 0
|
|
273
|
+
|
|
274
|
+
return Object.keys(this.value.items.reduce((acc, item) => {
|
|
275
|
+
acc[item[this.column]] = 1
|
|
276
|
+
return acc
|
|
277
|
+
}, {})).length
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
datasets(){
|
|
281
|
+
if(!Array.isArray(this.value?.items)) return []
|
|
282
|
+
|
|
283
|
+
const grouped = this.value.items.reduce((acc, item) => {
|
|
284
|
+
if(!acc[item[this.column]]) acc[item[this.column]] = 0
|
|
285
|
+
acc[item[this.column]] += 1
|
|
286
|
+
return acc
|
|
287
|
+
}, {})
|
|
288
|
+
|
|
289
|
+
const datasets = []
|
|
290
|
+
for(let coord in grouped){
|
|
291
|
+
datasets.push([parseFloat(coord.split(',')[0]), parseFloat(coord.split(',')[1]), grouped[coord]])
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return datasets
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
watch: {
|
|
300
|
+
|
|
301
|
+
datasets(){
|
|
302
|
+
this.load()
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
</script>
|
|
310
|
+
|
|
311
|
+
<style module>
|
|
312
|
+
|
|
313
|
+
.comp{
|
|
314
|
+
@apply flex flex-col h-[40vh] border-[1px] border-text-50 bg-base-500 rounded-xl overflow-hidden;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
</style>
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex">
|
|
3
|
+
<div v-if="config.apiKey" ref="map" class="flex-1"></div>
|
|
4
|
+
<div v-else class="flex-1 flex items-center justify-center text-text-400">{{ error }}</div>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
|
|
10
|
+
import { Loader } from '@googlemaps/js-api-loader';
|
|
11
|
+
|
|
12
|
+
export default{
|
|
13
|
+
|
|
14
|
+
props: {
|
|
15
|
+
value: Array,
|
|
16
|
+
|
|
17
|
+
config: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default: {}
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
data(){
|
|
24
|
+
return {
|
|
25
|
+
error: this.$t('Google maps api required'),
|
|
26
|
+
map: null
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
mounted() {
|
|
31
|
+
this.load()
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
methods: {
|
|
35
|
+
|
|
36
|
+
load(){
|
|
37
|
+
if(!this.config.apiKey) return
|
|
38
|
+
if(!this.value) return this.error = 'No value'
|
|
39
|
+
|
|
40
|
+
const loader = new Loader({
|
|
41
|
+
apiKey: this.config.apiKey // "AIzaSyBmzMlmrR5St-njtN--64y_oLTa9FDLYfQ"
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
loader.load()
|
|
45
|
+
.then(async () => {
|
|
46
|
+
|
|
47
|
+
loader.load().then(() => {
|
|
48
|
+
if(!Array.isArray(this.value) || this.value.length < 1) return
|
|
49
|
+
|
|
50
|
+
const map = new google.maps.Map(this.$refs.map, {
|
|
51
|
+
center: this.value[0], // Example: San Francisco
|
|
52
|
+
zoom: 12,
|
|
53
|
+
mapTypeId: 'roadmap',
|
|
54
|
+
streetViewControl: false,
|
|
55
|
+
keyboardShortcuts: false,
|
|
56
|
+
styles: [
|
|
57
|
+
{ elementType: "geometry", stylers: [{ color: "#242f3e" }] },
|
|
58
|
+
{ elementType: "labels.text.stroke", stylers: [{ color: "#242f3e" }] },
|
|
59
|
+
{ elementType: "labels.text.fill", stylers: [{ color: "#746855" }] },
|
|
60
|
+
{
|
|
61
|
+
featureType: "administrative.locality",
|
|
62
|
+
elementType: "labels.text.fill",
|
|
63
|
+
stylers: [{ color: "#d59563" }],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
featureType: "poi",
|
|
67
|
+
elementType: "labels.text.fill",
|
|
68
|
+
stylers: [{ color: "#d59563" }],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
featureType: "poi.park",
|
|
72
|
+
elementType: "geometry",
|
|
73
|
+
stylers: [{ color: "#263c3f" }],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
featureType: "poi.park",
|
|
77
|
+
elementType: "labels.text.fill",
|
|
78
|
+
stylers: [{ color: "#6b9a76" }],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
featureType: "road",
|
|
82
|
+
elementType: "geometry",
|
|
83
|
+
stylers: [{ color: "#38414e" }],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
featureType: "road",
|
|
87
|
+
elementType: "geometry.stroke",
|
|
88
|
+
stylers: [{ color: "#212a37" }],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
featureType: "road",
|
|
92
|
+
elementType: "labels.text.fill",
|
|
93
|
+
stylers: [{ color: "#9ca5b3" }],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
featureType: "road.highway",
|
|
97
|
+
elementType: "geometry",
|
|
98
|
+
stylers: [{ color: "#746855" }],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
featureType: "road.highway",
|
|
102
|
+
elementType: "geometry.stroke",
|
|
103
|
+
stylers: [{ color: "#1f2835" }],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
featureType: "road.highway",
|
|
107
|
+
elementType: "labels.text.fill",
|
|
108
|
+
stylers: [{ color: "#f3d19c" }],
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
featureType: "transit",
|
|
112
|
+
elementType: "geometry",
|
|
113
|
+
stylers: [{ color: "#2f3948" }],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
featureType: "transit.station",
|
|
117
|
+
elementType: "labels.text.fill",
|
|
118
|
+
stylers: [{ color: "#d59563" }],
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
featureType: "water",
|
|
122
|
+
elementType: "geometry",
|
|
123
|
+
stylers: [{ color: "#17263c" }],
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
featureType: "water",
|
|
127
|
+
elementType: "labels.text.fill",
|
|
128
|
+
stylers: [{ color: "#515c6d" }],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
featureType: "water",
|
|
132
|
+
elementType: "labels.text.stroke",
|
|
133
|
+
stylers: [{ color: "#17263c" }],
|
|
134
|
+
},
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const root = document.documentElement;
|
|
139
|
+
const primaryColor600 = getComputedStyle(root).getPropertyValue('--primary-600').trim()
|
|
140
|
+
const primaryColor300 = getComputedStyle(root).getPropertyValue('--primary-300').trim()
|
|
141
|
+
|
|
142
|
+
const line = new google.maps.Polyline({
|
|
143
|
+
path: this.value,
|
|
144
|
+
geodesic: true,
|
|
145
|
+
strokeColor: `rgb(${primaryColor600})`,
|
|
146
|
+
strokeOpacity: .8,
|
|
147
|
+
strokeWeight: 6,
|
|
148
|
+
});
|
|
149
|
+
line.setMap(map);
|
|
150
|
+
|
|
151
|
+
for(let i = this.value.length - 1 ; i >= 0 ; i--){
|
|
152
|
+
const point = this.value[i]
|
|
153
|
+
|
|
154
|
+
new google.maps.Circle({
|
|
155
|
+
strokeColor: `rgb(${primaryColor600})`,
|
|
156
|
+
strokeOpacity: 0.8,
|
|
157
|
+
strokeWeight: 2,
|
|
158
|
+
fillColor: i === 0 ? '#FFF' : `rgb(${primaryColor300})`,
|
|
159
|
+
fillOpacity: .8,
|
|
160
|
+
map,
|
|
161
|
+
center: point,
|
|
162
|
+
radius: 10, // Radius in meters (adjust as needed)
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
}).catch(e => {
|
|
167
|
+
this.error = 'Error loading Google Maps JavaScript API'
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
watch: {
|
|
175
|
+
|
|
176
|
+
data(){
|
|
177
|
+
this.load()
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
</script>
|
|
184
|
+
|
|
185
|
+
<style module>
|
|
186
|
+
|
|
187
|
+
.comp{
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
</style>
|
package/src/components/Grid.vue
CHANGED
|
@@ -484,13 +484,13 @@ export default{
|
|
|
484
484
|
|
|
485
485
|
if(this.newImage.element){
|
|
486
486
|
const aDiv = document.createElement("div")
|
|
487
|
-
aDiv.innerHTML = "<img src=\"" + url + "\" " + propHtml.join(' ') + "/>"
|
|
487
|
+
aDiv.innerHTML = "<img src=\"" + url + "\" " + propHtml.join(' ') + " class='inline'/>"
|
|
488
488
|
this.newImage.element.parentNode.replaceChild(aDiv.firstChild, this.newImage.element)
|
|
489
489
|
}
|
|
490
490
|
|
|
491
491
|
else{
|
|
492
492
|
document.execCommand("insertHTML", false,
|
|
493
|
-
"<img src=\"" + url + "\" " + propHtml.join(' ') + "/>");
|
|
493
|
+
"<img src=\"" + url + "\" " + propHtml.join(' ') + " class='inline'/>");
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
this.$refs.imageModal.close()
|