@mapomodule/uikit 1.0.0-alpha.49 → 1.0.0-alpha.50
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/CHANGELOG.md +14 -0
- package/components/Detail/Detail.vue +17 -1
- package/components/Form/defaults.js +2 -0
- package/components/Form/fields/DateTimeField.vue +1 -0
- package/components/Form/fields/TimeField.vue +1 -0
- package/components/Form/fields/mapField/leaflet.injector.js +39 -0
- package/components/Form/fields/mapField/mapField.vue +348 -0
- package/components/Form/fields/wygEditor/wygEditor.vue +1 -1
- package/components/PagePreview.vue +58 -0
- package/package.json +2 -2
- package/translations/en-US.js +10 -0
- package/translations/it-IT.js +10 -0
- /package/components/Form/fields/wygEditor/utils/{script.injector.js → tinymce.injector.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-alpha.50](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.49...v1.0.0-alpha.50) (2024-01-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* added MapField ([3ba3b26](https://github.com/lotrekagency/mapo/commit/3ba3b262120a543f187ee4a5e9f24d31a7a1e1b4))
|
|
12
|
+
* **Detail:** added PagePreview component ([9ed8975](https://github.com/lotrekagency/mapo/commit/9ed8975ba60a5954abe985a0565a198ea7f62aad))
|
|
13
|
+
* **fields:** added geo point field ([ba0dd0c](https://github.com/lotrekagency/mapo/commit/ba0dd0c782524914826941b2cbdf7b4169a35afe))
|
|
14
|
+
* **Time and DateTime:** added Ok button to close menu ([11f1d1e](https://github.com/lotrekagency/mapo/commit/11f1d1e52e45d154a064eb545e2812a0c8cf1f7b))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
6
20
|
# [1.0.0-alpha.49](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.48...v1.0.0-alpha.49) (2023-07-27)
|
|
7
21
|
|
|
8
22
|
|
|
@@ -116,6 +116,14 @@
|
|
|
116
116
|
>{{ $t("mapo.delete") }}</v-btn
|
|
117
117
|
>
|
|
118
118
|
</slot>
|
|
119
|
+
<!-- Use this to override the Preview Page button. -->
|
|
120
|
+
<slot name="button.preview" v-bind="slotBindings">
|
|
121
|
+
<!-- The Preview Page button. Needs a preview field from model. Declare it in the props. -->
|
|
122
|
+
<PagePreview
|
|
123
|
+
v-if="previewUrl"
|
|
124
|
+
:pageUrl="previewUrl"
|
|
125
|
+
/>
|
|
126
|
+
</slot>
|
|
119
127
|
</div>
|
|
120
128
|
</slot>
|
|
121
129
|
<!-- Use this to add content on the top of the sidebar fields (or under sidebar buttons). -->
|
|
@@ -281,6 +289,11 @@ export default {
|
|
|
281
289
|
return ["auto", "force", "disable"].indexOf(value) !== -1;
|
|
282
290
|
},
|
|
283
291
|
},
|
|
292
|
+
// The name of the field that contains the url of the page preview. [optional]
|
|
293
|
+
previewField: {
|
|
294
|
+
type: String,
|
|
295
|
+
required: false,
|
|
296
|
+
},
|
|
284
297
|
// This forces the detail page to be readonly.
|
|
285
298
|
readonly: Boolean
|
|
286
299
|
},
|
|
@@ -296,7 +309,7 @@ export default {
|
|
|
296
309
|
this.$refs.form?.resetValidation();
|
|
297
310
|
this.apiSendPayload()
|
|
298
311
|
.then((resp) => {
|
|
299
|
-
this.model
|
|
312
|
+
Object.assign(this.model, resp);
|
|
300
313
|
this.modelBkp = deepClone(this.model);
|
|
301
314
|
this.$mapo.$snack.open({
|
|
302
315
|
message: this.isNew
|
|
@@ -491,6 +504,9 @@ export default {
|
|
|
491
504
|
hasDiff() {
|
|
492
505
|
return !!(this.modelDiff && Object.keys(this.modelDiff).length > 0);
|
|
493
506
|
},
|
|
507
|
+
previewUrl() {
|
|
508
|
+
return this.previewField ? this.model[this.previewField] : null;
|
|
509
|
+
},
|
|
494
510
|
},
|
|
495
511
|
async mounted() {
|
|
496
512
|
if (this.identifier && this.identifier !== "new") {
|
|
@@ -29,6 +29,7 @@ const components = {
|
|
|
29
29
|
FileField: () => import("@mapomodule/uikit/components/Form/fields/FileField.vue"),
|
|
30
30
|
Repeater: () => import("@mapomodule/uikit/components/Form/fields/Repeater.vue"),
|
|
31
31
|
ColorField: () => import("@mapomodule/uikit/components/Form/fields/ColorField.vue"),
|
|
32
|
+
MapField: () => import("@mapomodule/uikit/components/Form/fields/mapField/mapField.vue"),
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
const mapping = {
|
|
@@ -50,6 +51,7 @@ const mapping = {
|
|
|
50
51
|
seoPreview: components.SeoPreview,
|
|
51
52
|
repeater: components.Repeater,
|
|
52
53
|
color: components.ColorField,
|
|
54
|
+
map: components.MapField
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
const attrs = {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default async function () {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
if (typeof window.L !== 'undefined'){
|
|
4
|
+
resolve()
|
|
5
|
+
}
|
|
6
|
+
let scriptTag = document.getElementById("leaflet-script") || null
|
|
7
|
+
let styleTag = document.getElementById("leaflet-style") || null
|
|
8
|
+
const handler = () => {
|
|
9
|
+
scriptTag.removeEventListener('load', handler);
|
|
10
|
+
resolve()
|
|
11
|
+
};
|
|
12
|
+
if (!scriptTag) {
|
|
13
|
+
try {
|
|
14
|
+
scriptTag = document.createElement('script');
|
|
15
|
+
scriptTag.src = "https://unpkg.com/leaflet@1.7.1/dist/leaflet.js",
|
|
16
|
+
scriptTag.crossorigin = "anonymous",
|
|
17
|
+
scriptTag.async = true,
|
|
18
|
+
scriptTag.referrerPolicy = 'origin';
|
|
19
|
+
scriptTag.type = 'application/javascript';
|
|
20
|
+
scriptTag.id = 'leaflet-script';
|
|
21
|
+
scriptTag.addEventListener('load', handler);
|
|
22
|
+
document.head.appendChild(scriptTag);
|
|
23
|
+
styleTag = document.createElement('link');
|
|
24
|
+
|
|
25
|
+
styleTag.rel = "stylesheet",
|
|
26
|
+
styleTag.href = "https://unpkg.com/leaflet@1.7.1/dist/leaflet.css",
|
|
27
|
+
styleTag.crossorigin = "anonymous",
|
|
28
|
+
styleTag.id = 'leaflet-style';
|
|
29
|
+
document.head.appendChild(styleTag);
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
} catch (error) {
|
|
33
|
+
reject(error)
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
scriptTag.addEventListener('load', handler);
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<span v-if="label" class="v-label" :class="{'error--text': hasErrors, 'text--secondary': !hasErrors}">{{ label }}:</span>
|
|
4
|
+
<div ref="map" class="map"></div>
|
|
5
|
+
<div class="map-fields">
|
|
6
|
+
<div class="row search-row">
|
|
7
|
+
<div class="col-sm-12" style="padding: 0px">
|
|
8
|
+
<v-text-field
|
|
9
|
+
v-model="searchQuery"
|
|
10
|
+
:label="$t('mapo.searchLocation')"
|
|
11
|
+
@input="debouncedSearchLocation()"
|
|
12
|
+
v-bind="{ ...$attrs }"
|
|
13
|
+
class="col"
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="row input-gap" style="margin-top: 1rem;" v-for="(point, index) in model" :key="index">
|
|
18
|
+
<div class="col-sm-12"><v-divider></v-divider></div>
|
|
19
|
+
<div class="col-sm-6">
|
|
20
|
+
<div class="row">
|
|
21
|
+
<v-text-field
|
|
22
|
+
v-model="point.pointName"
|
|
23
|
+
:label="$t('mapo.pointName')"
|
|
24
|
+
v-bind="{ ...$attrs }"
|
|
25
|
+
ref="pointName"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="col">
|
|
30
|
+
<div class="row">
|
|
31
|
+
<v-text-field
|
|
32
|
+
v-model="point.lat"
|
|
33
|
+
:label="$t('mapo.latitude')"
|
|
34
|
+
v-bind="{ ...$attrs }"
|
|
35
|
+
readonly
|
|
36
|
+
class="col-5"
|
|
37
|
+
/>
|
|
38
|
+
<v-text-field
|
|
39
|
+
v-model="point.lon"
|
|
40
|
+
:label="$t('mapo.longitude')"
|
|
41
|
+
v-bind="{ ...$attrs }"
|
|
42
|
+
readonly
|
|
43
|
+
class="col-5"
|
|
44
|
+
/>
|
|
45
|
+
<v-btn
|
|
46
|
+
v-if="!readonly"
|
|
47
|
+
@click="removePointFromModel(index)"
|
|
48
|
+
class="col"
|
|
49
|
+
icon
|
|
50
|
+
><v-icon>mdi-close</v-icon></v-btn
|
|
51
|
+
>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="col-sm-12">
|
|
55
|
+
<div class="row">
|
|
56
|
+
<Form
|
|
57
|
+
v-model="point.extra_fields"
|
|
58
|
+
:fields="getFields(model.extra_fields)"
|
|
59
|
+
:errors="getErrors(index)"
|
|
60
|
+
:readonly="readonly"
|
|
61
|
+
immediate
|
|
62
|
+
>
|
|
63
|
+
<template
|
|
64
|
+
v-for="(slot, name) in templateSlots(model, $slots)"
|
|
65
|
+
:slot="slot"
|
|
66
|
+
>
|
|
67
|
+
<slot :name="name"></slot>
|
|
68
|
+
</template>
|
|
69
|
+
<template
|
|
70
|
+
v-for="(slot, name) in templateSlots(model, $scopedSlots)"
|
|
71
|
+
v-slot:[slot]="props"
|
|
72
|
+
>
|
|
73
|
+
<slot :name="name" v-bind="props" />
|
|
74
|
+
</template>
|
|
75
|
+
</Form>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</template>
|
|
82
|
+
|
|
83
|
+
<style>
|
|
84
|
+
.map {
|
|
85
|
+
height: 400px;
|
|
86
|
+
width: 100%;
|
|
87
|
+
}
|
|
88
|
+
.map-fields {
|
|
89
|
+
margin-top: 10px;
|
|
90
|
+
max-width: 100%;
|
|
91
|
+
padding: 12px;
|
|
92
|
+
}
|
|
93
|
+
.input-gap {
|
|
94
|
+
gap: 8px;
|
|
95
|
+
}
|
|
96
|
+
.search-row {
|
|
97
|
+
margin-bottom: 10px;
|
|
98
|
+
& > div {
|
|
99
|
+
padding: 0 !important;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</style>
|
|
103
|
+
|
|
104
|
+
<script>
|
|
105
|
+
/**
|
|
106
|
+
* This component is made to get coordinates from a map.
|
|
107
|
+
*/
|
|
108
|
+
import { debounce } from "@mapomodule/utils/helpers/debounce";
|
|
109
|
+
import injectScript from "./leaflet.injector.js";
|
|
110
|
+
import { nameSpacedSlots } from "@mapomodule/utils/helpers/slots";
|
|
111
|
+
|
|
112
|
+
export default {
|
|
113
|
+
name: "MapField",
|
|
114
|
+
components: {
|
|
115
|
+
// For recursive dynamic components is better to resolve dependencies at runtime to avoid circular deps
|
|
116
|
+
Form: () => import("@mapomodule/uikit/components/Form/Form.vue"),
|
|
117
|
+
},
|
|
118
|
+
props: {
|
|
119
|
+
// V-model property.
|
|
120
|
+
value: {
|
|
121
|
+
type: Array,
|
|
122
|
+
},
|
|
123
|
+
// This label will be shown at the top of the editor.
|
|
124
|
+
label: String,
|
|
125
|
+
// This set the component status to readonly, stopping the user interaction.
|
|
126
|
+
readonly: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: false,
|
|
129
|
+
},
|
|
130
|
+
// This set the component status to multiple, allowing the user to add multiple points. Pass it into attrs
|
|
131
|
+
multiple: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: false,
|
|
134
|
+
},
|
|
135
|
+
fields: {
|
|
136
|
+
// [`Array<FieldConfiguration>`](/components/Detail/Detail/#fieldconfiguration)
|
|
137
|
+
type: Array | Object,
|
|
138
|
+
default: () => [],
|
|
139
|
+
},
|
|
140
|
+
// Puts the input in an error state and passes through custom error messages.
|
|
141
|
+
errorMessages: {
|
|
142
|
+
type: Array,
|
|
143
|
+
default: () => [],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
data() {
|
|
147
|
+
return {
|
|
148
|
+
model: this.value || [],
|
|
149
|
+
map: null,
|
|
150
|
+
searchQuery: "",
|
|
151
|
+
markers: [],
|
|
152
|
+
};
|
|
153
|
+
},
|
|
154
|
+
watch: {
|
|
155
|
+
value(val) {
|
|
156
|
+
this.model = val || [];
|
|
157
|
+
},
|
|
158
|
+
model(val) {
|
|
159
|
+
this.$emit("input", val);
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
mounted() {
|
|
163
|
+
injectScript().then(this.initMap);
|
|
164
|
+
},
|
|
165
|
+
methods: {
|
|
166
|
+
initMap() {
|
|
167
|
+
const coordinates = this.model || [];
|
|
168
|
+
if (coordinates.length > 0) {
|
|
169
|
+
const { lat, lon } = coordinates[coordinates.length - 1];
|
|
170
|
+
this.map = L.map(this.$refs.map).setView([lat, lon], 12);
|
|
171
|
+
coordinates.forEach((point, index) => {
|
|
172
|
+
const marker = L.marker([point.lat, point.lon]).addTo(this.map);
|
|
173
|
+
this.markers[index] = marker;
|
|
174
|
+
});
|
|
175
|
+
this.map.fitBounds(coordinates.map((point) => [point.lat, point.lon]));
|
|
176
|
+
} else {
|
|
177
|
+
this.map = L.map(this.$refs.map).setView([0, 0], 2);
|
|
178
|
+
}
|
|
179
|
+
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
180
|
+
attribution: "© OpenStreetMap contributors",
|
|
181
|
+
}).addTo(this.map);
|
|
182
|
+
this.handleClickOnMap();
|
|
183
|
+
},
|
|
184
|
+
handleClickOnMap() {
|
|
185
|
+
this.map.on("click", async (event) => {
|
|
186
|
+
const coordinates = event.latlng;
|
|
187
|
+
|
|
188
|
+
if (!this.multiple) {
|
|
189
|
+
this.removeAllMarkers();
|
|
190
|
+
this.model = [];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
this.model.push({
|
|
194
|
+
lat: coordinates.lat,
|
|
195
|
+
lon: coordinates.lng,
|
|
196
|
+
pointName: "",
|
|
197
|
+
extra_fields: {},
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const marker = L.marker([coordinates.lat, coordinates.lng]).addTo(
|
|
201
|
+
this.map
|
|
202
|
+
);
|
|
203
|
+
this.markers.push(marker);
|
|
204
|
+
await this.reverseGeoCoding(coordinates.lat, coordinates.lng);
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
removeAllMarkers() {
|
|
208
|
+
this.markers.forEach((marker) => this.map.removeLayer(marker));
|
|
209
|
+
this.markers = [];
|
|
210
|
+
},
|
|
211
|
+
async reverseGeoCoding(lat, lon) {
|
|
212
|
+
const reverseGeocodingResponse = await this.$axios.get(
|
|
213
|
+
"https://nominatim.openstreetmap.org/reverse",
|
|
214
|
+
{
|
|
215
|
+
params: {
|
|
216
|
+
lat,
|
|
217
|
+
lon,
|
|
218
|
+
format: "json",
|
|
219
|
+
addressdetails: 1,
|
|
220
|
+
"accept-language": this.$attrs.currentLang || "en",
|
|
221
|
+
},
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
if (
|
|
226
|
+
reverseGeocodingResponse.data &&
|
|
227
|
+
reverseGeocodingResponse.data.display_name
|
|
228
|
+
) {
|
|
229
|
+
this.model[this.currentIndex].pointName =
|
|
230
|
+
reverseGeocodingResponse.data.display_name;
|
|
231
|
+
} else {
|
|
232
|
+
this.model[this.currentIndex].pointName = this.searchQuery;
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
removePointFromModel(index) {
|
|
236
|
+
this.map.removeLayer(this.markers[index]);
|
|
237
|
+
this.markers.splice(index, 1);
|
|
238
|
+
this.model.splice(index, 1);
|
|
239
|
+
|
|
240
|
+
if (this.model.length > 0) {
|
|
241
|
+
this.map.fitBounds(this.model.map((point) => [point.lat, point.lon]));
|
|
242
|
+
} else {
|
|
243
|
+
this.map.setView([0, 0], 2);
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
async searchLocation() {
|
|
247
|
+
try {
|
|
248
|
+
const response = await this.$axios.get(
|
|
249
|
+
"https://nominatim.openstreetmap.org/search",
|
|
250
|
+
{
|
|
251
|
+
params: {
|
|
252
|
+
q: this.searchQuery,
|
|
253
|
+
format: "json",
|
|
254
|
+
limit: 1,
|
|
255
|
+
},
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
if (response.data.length > 0) {
|
|
260
|
+
if (!this.multiple) {
|
|
261
|
+
this.removeAllMarkers();
|
|
262
|
+
this.model = [];
|
|
263
|
+
}
|
|
264
|
+
const { lat, lon } = response.data[0];
|
|
265
|
+
this.map.setView([lat, lon], 12);
|
|
266
|
+
|
|
267
|
+
const marker = L.marker([lat, lon]).addTo(this.map);
|
|
268
|
+
this.markers.push(marker);
|
|
269
|
+
|
|
270
|
+
this.model.push({
|
|
271
|
+
lat,
|
|
272
|
+
lon,
|
|
273
|
+
pointName: this.searchQuery,
|
|
274
|
+
extra_fields: {},
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
await this.reverseGeoCoding(lat, lon);
|
|
278
|
+
this.map.fitBounds(this.model.map((point) => [point.lat, point.lon]));
|
|
279
|
+
}
|
|
280
|
+
} catch (error) {
|
|
281
|
+
console.error(`${this.$t("mapo.error.searchError")}: `, error);
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
debouncedSearchLocation: debounce(function () {
|
|
285
|
+
this.searchLocation();
|
|
286
|
+
}, 500),
|
|
287
|
+
getErrors(index) {
|
|
288
|
+
return (this.errorMessages[index]) || {};
|
|
289
|
+
},
|
|
290
|
+
getFields(model) {
|
|
291
|
+
if (this.hasTemplates) {
|
|
292
|
+
const template = this.templates.find(
|
|
293
|
+
(t) => model[t.tCodeField] == t.tCode
|
|
294
|
+
);
|
|
295
|
+
return template ? template.fields : [];
|
|
296
|
+
}
|
|
297
|
+
return this.fields;
|
|
298
|
+
},
|
|
299
|
+
templateSlots(model, slots) {
|
|
300
|
+
if (this.hasTemplates) {
|
|
301
|
+
const template = this.templates.find(
|
|
302
|
+
(t) => model[t.tCodeField] == t.tCode
|
|
303
|
+
);
|
|
304
|
+
return nameSpacedSlots(slots, `template.${template.tCode}.`).reduce(
|
|
305
|
+
(acc, v) => ({ [`template.${template.tCode}.${v}`]: v, ...acc }),
|
|
306
|
+
{}
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
return Object.keys(slots).reduce((acc, v) => ({ [v]: v, ...acc }), {});
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
computed: {
|
|
313
|
+
lat() {
|
|
314
|
+
return this.model?.lat || "";
|
|
315
|
+
},
|
|
316
|
+
lon() {
|
|
317
|
+
return this.model?.lon || "";
|
|
318
|
+
},
|
|
319
|
+
pointName() {
|
|
320
|
+
return this.model?.pointName || "";
|
|
321
|
+
},
|
|
322
|
+
currentIndex() {
|
|
323
|
+
return this.model.length > 0 ? this.model.length - 1 : 0;
|
|
324
|
+
},
|
|
325
|
+
hasTemplates() {
|
|
326
|
+
return typeof this.fields == "object" && !Array.isArray(this.fields);
|
|
327
|
+
},
|
|
328
|
+
templates() {
|
|
329
|
+
const templates = {};
|
|
330
|
+
if (this.hasTemplates) {
|
|
331
|
+
Object.keys(this.fields).forEach((tKey) => {
|
|
332
|
+
const tValue = this.fields[tKey];
|
|
333
|
+
const { preview, description } = tValue;
|
|
334
|
+
templates[tKey] = {
|
|
335
|
+
fields: tValue.fields || tValue,
|
|
336
|
+
name: tValue.name || titleCase(tKey.replace(/_/, " ")),
|
|
337
|
+
tCode: tValue.tCode || tKey,
|
|
338
|
+
tCodeField: tValue.tCodeField || "tCode",
|
|
339
|
+
preview,
|
|
340
|
+
description,
|
|
341
|
+
};
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
return Object.values(templates);
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
};
|
|
348
|
+
</script>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
<script>
|
|
35
35
|
import initMapoMedia from "./utils/mapomedia.plugin.js";
|
|
36
|
-
import injectScript from "./utils/
|
|
36
|
+
import injectScript from "./utils/tinymce.injector.js";
|
|
37
37
|
import defaults from "./defaults.js";
|
|
38
38
|
import validEvents from "./utils/events.js";
|
|
39
39
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-dialog v-model="dialog" width="90vw">
|
|
3
|
+
<template v-slot:activator="{ on, attrs }">
|
|
4
|
+
<v-btn tile block @click="openPreview(true)" color="primary" class="mb-2">
|
|
5
|
+
{{ $t("mapo.showPreview") }}</v-btn
|
|
6
|
+
>
|
|
7
|
+
</template>
|
|
8
|
+
<v-card class="iframe-card">
|
|
9
|
+
<iframe :src="computedUrl" class="iframe-preview"></iframe>
|
|
10
|
+
</v-card>
|
|
11
|
+
</v-dialog>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<style lang="scss" scoped>
|
|
15
|
+
.iframe-card {
|
|
16
|
+
height: 90vh;
|
|
17
|
+
min-height: 90vh;
|
|
18
|
+
}
|
|
19
|
+
.iframe-preview {
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
border: none;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
export default {
|
|
28
|
+
name: "PagePreview",
|
|
29
|
+
props: {
|
|
30
|
+
pageUrl: {
|
|
31
|
+
type: String,
|
|
32
|
+
reruired: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
data() {
|
|
36
|
+
return {
|
|
37
|
+
dialog: false,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
methods: {
|
|
41
|
+
openPreview() {
|
|
42
|
+
this.dialog = true;
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
computed: {
|
|
46
|
+
checkifUrlIsAbsolute() {
|
|
47
|
+
return this.pageUrl.startsWith("http");
|
|
48
|
+
},
|
|
49
|
+
computedUrl() {
|
|
50
|
+
if (this.checkifUrlIsAbsolute) {
|
|
51
|
+
return this.pageUrl;
|
|
52
|
+
} else {
|
|
53
|
+
return `/${this.pageUrl}`;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/uikit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.50",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "This is part of Mapo nuxt module. Injects Mapo ui components in the nuxt component discovery system.",
|
|
6
6
|
"author": "bnznamco <gabriele.baldi.01@gmail.com>",
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "f98d383d36a57064d5f5fc56a636f9526cb91116"
|
|
19
19
|
}
|
package/translations/en-US.js
CHANGED
|
@@ -40,6 +40,11 @@ export default {
|
|
|
40
40
|
altTag: "Alt Tag",
|
|
41
41
|
titleTag: "Title Tag",
|
|
42
42
|
linkedModels: "Linked Models",
|
|
43
|
+
searchLocation: "Search a location",
|
|
44
|
+
showPreview: "Show preview",
|
|
45
|
+
latitude: "Latitude",
|
|
46
|
+
longitude: "Longitude",
|
|
47
|
+
pointName: "Point name",
|
|
43
48
|
|
|
44
49
|
// pages/index.vue
|
|
45
50
|
index: {
|
|
@@ -47,6 +52,11 @@ export default {
|
|
|
47
52
|
"Congratulations!! 🥳 You successfully installed Mapo!",
|
|
48
53
|
},
|
|
49
54
|
|
|
55
|
+
//errors
|
|
56
|
+
error: {
|
|
57
|
+
searchError: "Error during search",
|
|
58
|
+
},
|
|
59
|
+
|
|
50
60
|
// ConfirmDialog.vue
|
|
51
61
|
confirmDialog: {
|
|
52
62
|
areYouSure: "Are you sure of what you are doing?",
|
package/translations/it-IT.js
CHANGED
|
@@ -41,6 +41,11 @@ export default {
|
|
|
41
41
|
altTag: "Alt Tag",
|
|
42
42
|
titleTag: "Title Tag",
|
|
43
43
|
linkedModels: "Modelli collegati",
|
|
44
|
+
searchLocation: "Cerca un luogo",
|
|
45
|
+
showPreview: "Mostra anteprima",
|
|
46
|
+
latitude: "Latitudine",
|
|
47
|
+
longitude: "Longitudine",
|
|
48
|
+
pointName: "Nome punto",
|
|
44
49
|
|
|
45
50
|
// pages/index.vue
|
|
46
51
|
index: {
|
|
@@ -48,6 +53,11 @@ export default {
|
|
|
48
53
|
"Congratulazioni!! 🥳 Mapo è stato installato correttamente!",
|
|
49
54
|
},
|
|
50
55
|
|
|
56
|
+
//errors
|
|
57
|
+
error: {
|
|
58
|
+
searchError: "Errore durante la ricerca",
|
|
59
|
+
},
|
|
60
|
+
|
|
51
61
|
// ConfirmDialog.vue
|
|
52
62
|
confirmDialog: {
|
|
53
63
|
areYouSure: "Sei sicuro di ciò che vuoi fare?",
|
|
File without changes
|