@mapomodule/uikit 1.0.0-alpha.5 → 1.0.0-alpha.51
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 +892 -0
- package/components/ConfirmDialog.vue +58 -37
- package/components/Detail/Detail.vue +450 -243
- package/components/Detail/DetailLangSwitch.vue +9 -2
- package/components/DropArea.vue +63 -56
- package/components/Form/Form.vue +218 -0
- package/components/Form/FormField.vue +214 -0
- package/components/Form/FormGroup.vue +146 -0
- package/components/Form/FormTabs.vue +188 -0
- package/components/Form/defaults.js +98 -0
- package/components/Form/fields/ColorField.vue +79 -0
- package/components/{fields → Form/fields}/DateField.vue +20 -11
- package/components/Form/fields/DateTimeField.vue +271 -0
- package/components/Form/fields/EnhancedMediaField.vue +224 -0
- package/components/Form/fields/FileField.vue +125 -0
- package/components/Form/fields/FksField.vue +88 -0
- package/components/Form/fields/MediaField.vue +159 -0
- package/components/Form/fields/MediaM2mField.vue +149 -0
- package/components/Form/fields/Repeater.vue +596 -0
- package/components/Form/fields/SeoPreview.vue +89 -0
- package/components/Form/fields/TimeField.vue +154 -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/defaults.js +25 -0
- package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/mapomedia.plugin.js +7 -6
- package/components/Form/fields/wygEditor/wygEditor.vue +285 -0
- package/components/Form/fields/wygEditorCKE/defaults.js +100 -0
- package/components/Form/fields/wygEditorCKE/utils/ckeditor.injector.js +29 -0
- package/components/Form/fields/wygEditorCKE/wygEditorCKE.vue +270 -0
- package/components/LangSwitcher.vue +44 -0
- package/components/List/List.vue +103 -51
- package/components/List/ListActions.vue +23 -5
- package/components/List/ListFilters.vue +166 -114
- package/components/List/ListHead.vue +30 -12
- package/components/List/ListQuickEdit.vue +130 -61
- package/components/List/ListTable.vue +210 -66
- package/components/Login.vue +17 -7
- package/components/LogoutButton.vue +43 -28
- package/components/MediaManager/MediaBreadcrumbs.vue +45 -0
- package/components/MediaManager/MediaEditor.vue +297 -120
- package/components/MediaManager/MediaFileChanger.vue +78 -0
- package/components/MediaManager/MediaFolders.vue +224 -116
- package/components/MediaManager/MediaGallery.vue +224 -145
- package/components/MediaManager/MediaManager.vue +125 -159
- package/components/MediaManager/MediaManagerDialog.vue +36 -31
- package/components/MediaManager/MediaPreview.vue +258 -0
- package/components/MediaManager/MediaUploader.vue +91 -90
- package/components/MenuManager/MenuManager.vue +332 -0
- package/components/MenuManager/MenuNodeEditor.vue +255 -0
- package/components/MenuManager/MenuTreeview.vue +237 -0
- package/components/MenuManager/MenuTreeviewNode.vue +208 -0
- package/components/PagePreview.vue +58 -0
- package/components/SnackBar.vue +5 -7
- package/components/ThemeToggle.vue +13 -0
- package/components/layout/Sidebar/Sidebar.vue +61 -30
- package/components/layout/Sidebar/SidebarList.vue +19 -15
- package/components/layout/Sidebar/SidebarListItem.vue +122 -38
- package/components/layout/Sidebar/SidebarProfile.vue +42 -0
- package/components/layout/Sidebar/SidebarTitle.vue +45 -0
- package/components/layout/Topbar/Topbar.vue +11 -42
- package/components/layout/routebuilder.js +3 -3
- package/defaults/i18n.js +37 -0
- package/defaults/vuetify.js +34 -0
- package/layouts/default.vue +33 -18
- package/layouts/empty.vue +10 -0
- package/module.js +7 -5
- package/package.json +6 -4
- package/pages/index.vue +19 -18
- package/static/mapo/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/dev/contents.css +35 -0
- package/static/mapo/ckeditor/plugins/image2/dev/image2.html +338 -0
- package/static/mapo/ckeditor/plugins/image2/dialogs/image2.js +557 -0
- package/static/mapo/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
- package/static/mapo/ckeditor/plugins/image2/icons/image.png +0 -0
- package/static/mapo/ckeditor/plugins/image2/lang/af.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ar.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/az.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/bg.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/bn.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/bs.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ca.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/cs.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/cy.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/da.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/de-ch.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/de.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/el.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/en-au.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/en-ca.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/en-gb.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/en.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/eo.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/es-mx.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/es.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/et.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/eu.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/fa.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/fi.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/fo.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/fr-ca.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/fr.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/gl.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/gu.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/he.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/hi.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/hr.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/hu.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/id.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/is.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/it.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ja.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ka.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/km.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ko.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ku.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/lt.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/lv.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/mk.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/mn.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ms.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/nb.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/nl.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/no.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/oc.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/pl.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/pt-br.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/pt.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ro.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ru.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/si.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sk.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sl.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sq.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sr-latn.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sr.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sv.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/th.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/tr.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/tt.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ug.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/uk.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/vi.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/zh-cn.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/zh.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/plugin.js +1798 -0
- package/static/mapo/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/samples/image2.html +68 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons16.png +0 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons16.svg +2374 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons32.png +0 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons32.svg +2722 -0
- package/static/mapo/ckeditor/skins/moono/dev/locations.json +144 -0
- package/static/mapo/ckeditor/skins/moono/dialog.css +5 -0
- package/static/mapo/ckeditor/skins/moono/dialog_ie.css +5 -0
- package/static/mapo/ckeditor/skins/moono/dialog_ie7.css +5 -0
- package/static/mapo/ckeditor/skins/moono/dialog_ie8.css +5 -0
- package/static/mapo/ckeditor/skins/moono/dialog_iequirks.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor_gecko.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor_ie.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor_ie7.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor_ie8.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor_iequirks.css +5 -0
- package/static/mapo/ckeditor/skins/moono/icons.png +0 -0
- package/static/mapo/ckeditor/skins/moono/icons_hidpi.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/anchor.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/arrow.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/anchor.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/spinner.gif +0 -0
- package/static/mapo/ckeditor/skins/moono/readme.md +49 -0
- package/static/mapo/ckeditor/skins/moono/skin.js +10 -0
- package/static/mapo/ckeditor/skins/moono-dark/dialog.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie7.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie8.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/dialog_iequirks.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor_gecko.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie7.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie8.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor_iequirks.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/icons.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/icons_hidpi.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/arrow.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/readme.md +51 -0
- package/static/mapo/ckeditor/skins/moono-dark/skin.js +5 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
- package/translations/en-US.js +177 -0
- package/translations/it-IT.js +180 -0
- package/components/Detail/DetailField.vue +0 -129
- package/components/Detail/defaults.js +0 -50
- package/components/fields/M2mField.vue +0 -95
- package/components/fields/MediaField.vue +0 -195
- package/components/fields/MediaM2mField.vue +0 -238
- package/components/fields/TinyMce/TinyMce.vue +0 -177
- package/components/fields/TinyMce/defaults.js +0 -55
- package/components/layout/Sidebar/SidebarFooter.vue +0 -75
- package/defaults.js +0 -29
- package/layouts/error.vue +0 -45
- /package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/events.js +0 -0
- /package/components/{fields/TinyMce/utils/script.injector.js → Form/fields/wygEditor/utils/tinymce.injector.js} +0 -0
- /package/static/{favicon.ico → mapo/favicon.ico} +0 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-menu
|
|
4
|
+
ref="menu"
|
|
5
|
+
v-model="menu"
|
|
6
|
+
:close-on-content-click="false"
|
|
7
|
+
transition="scale-transition"
|
|
8
|
+
offset-y
|
|
9
|
+
min-width="auto"
|
|
10
|
+
>
|
|
11
|
+
<template v-slot:activator="{ on, attrs }">
|
|
12
|
+
<v-text-field
|
|
13
|
+
v-model="localModel"
|
|
14
|
+
prepend-inner-icon="mdi-clock"
|
|
15
|
+
v-bind="{ ...$attrs, ...attrs }"
|
|
16
|
+
v-on="readonly ? undefined : on"
|
|
17
|
+
readonly
|
|
18
|
+
:clearable="!readonly"
|
|
19
|
+
class="rounded-inherit"
|
|
20
|
+
></v-text-field>
|
|
21
|
+
</template>
|
|
22
|
+
<v-time-picker v-model="localModel" no-title v-bind="$attrs" ref="timePicker">
|
|
23
|
+
<div class="raw-input-container">
|
|
24
|
+
<input
|
|
25
|
+
:value="localModel"
|
|
26
|
+
type="time"
|
|
27
|
+
class="primary--text text-h6"
|
|
28
|
+
ref="rawInput"
|
|
29
|
+
@input="setModel"
|
|
30
|
+
autofocus
|
|
31
|
+
v-bind="$attrs"
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
<v-btn text @click="menu = false">{{ $t('mapo.ok') }}</v-btn>
|
|
35
|
+
</v-time-picker>
|
|
36
|
+
</v-menu>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<style scoped>
|
|
41
|
+
.rounded-inherit {
|
|
42
|
+
border-radius: inherit;
|
|
43
|
+
}
|
|
44
|
+
.raw-input-container {
|
|
45
|
+
width: 100%;
|
|
46
|
+
}
|
|
47
|
+
.raw-input-container input {
|
|
48
|
+
width: 100%;
|
|
49
|
+
text-align: center;
|
|
50
|
+
outline: none;
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
53
|
+
|
|
54
|
+
<script>
|
|
55
|
+
import {
|
|
56
|
+
formatLocalTime,
|
|
57
|
+
cleanDateStr,
|
|
58
|
+
formatUTCTime,
|
|
59
|
+
mergeTime,
|
|
60
|
+
} from "@mapomodule/utils/helpers/datetime";
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* This component is used to edit a time in iso format. It is a combination of "v-text-field" and "v-time-picker".
|
|
64
|
+
* Can get time from a full ISO date (as string in UTC timezone) or from string in a HH:MM:ss format.
|
|
65
|
+
*/
|
|
66
|
+
export default {
|
|
67
|
+
name: "TimeField",
|
|
68
|
+
data() {
|
|
69
|
+
return {
|
|
70
|
+
model: { model: null, returnDate: false },
|
|
71
|
+
menu: null,
|
|
72
|
+
isUpdating: false, // Add a flag to track updates
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
props: {
|
|
76
|
+
// V-model property. Is the time to be modified.
|
|
77
|
+
value: {
|
|
78
|
+
// `String`
|
|
79
|
+
type: String, // TODO: make it work also with arrays for ranges
|
|
80
|
+
},
|
|
81
|
+
// This set the component status to readonly, stopping the user interaction.
|
|
82
|
+
readonly: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
watch: {
|
|
88
|
+
value(val) {
|
|
89
|
+
if (!this.isUpdating) { // Check if an update is already in progress
|
|
90
|
+
const model = this.setupModel(val);
|
|
91
|
+
if (JSON.stringify(model) !== JSON.stringify(this.model)) {
|
|
92
|
+
this.isUpdating = true; // Set the flag to indicate an update is in progress
|
|
93
|
+
this.model = model;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
model: {
|
|
98
|
+
handler: function (val) {
|
|
99
|
+
// Fired when the v-model changes
|
|
100
|
+
//@arg Emits the time edited.
|
|
101
|
+
if (val.returnDate) this.$emit("input", val.model.toISOString());
|
|
102
|
+
else this.$emit("input", formatUTCTime(val.model));
|
|
103
|
+
},
|
|
104
|
+
deep: true,
|
|
105
|
+
},
|
|
106
|
+
menu(val) {
|
|
107
|
+
if (val)
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
this.$refs.rawInput.focus();
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
computed: {
|
|
114
|
+
localModel: {
|
|
115
|
+
get() {
|
|
116
|
+
return this.model?.model && formatLocalTime(this.model?.model);
|
|
117
|
+
},
|
|
118
|
+
set(value) {
|
|
119
|
+
this.model.model = mergeTime(this?.model?.model || new Date(), value);
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
methods: {
|
|
124
|
+
setModel(evt) {
|
|
125
|
+
const model = evt.target.value;
|
|
126
|
+
const currentValue = this.localModel?.split(":") || [];
|
|
127
|
+
const nextValue = model?.split(":") || [];
|
|
128
|
+
for (
|
|
129
|
+
let index = 0;
|
|
130
|
+
index < Math.min(currentValue.length, nextValue.length);
|
|
131
|
+
index++
|
|
132
|
+
) {
|
|
133
|
+
if (currentValue[index] != nextValue[index]) {
|
|
134
|
+
this.$refs.timePicker.selecting = index + 1;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
this.localModel = model;
|
|
139
|
+
},
|
|
140
|
+
setupModel(val) {
|
|
141
|
+
const d = new Date(cleanDateStr(val));
|
|
142
|
+
const returnDate = !isNaN(d);
|
|
143
|
+
const model = !isNaN(d) ? d : mergeTime(new Date(), cleanDateStr(val));
|
|
144
|
+
return { returnDate, model };
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
mounted() {
|
|
148
|
+
this.model = this.setupModel(this.value); // Initialize the model on mount
|
|
149
|
+
},
|
|
150
|
+
updated() {
|
|
151
|
+
this.isUpdating = false; // Reset the flag after the component updates
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
</script>
|
|
@@ -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>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default ({ isDark, base }) => ({
|
|
2
|
+
plugins: "mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount textpattern noneditable help charmap quickbars emoticons",
|
|
3
|
+
menubar: "file edit view insert format tools table help",
|
|
4
|
+
menu: {
|
|
5
|
+
insert: {
|
|
6
|
+
title: "Insert",
|
|
7
|
+
items: "link mapomedia media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor | insertdatetime",
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
toolbar: "undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview | mapomedia media template link anchor codesample | ltr rtl",
|
|
11
|
+
toolbar_sticky: true,
|
|
12
|
+
image_advtab: true,
|
|
13
|
+
importcss_append: true,
|
|
14
|
+
template_cdate_format: "[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]",
|
|
15
|
+
template_mdate_format: "[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]",
|
|
16
|
+
height: 400,
|
|
17
|
+
image_caption: true,
|
|
18
|
+
quickbars_insert_toolbar: "mapomedia quicktable",
|
|
19
|
+
quickbars_selection_toolbar: "bold italic | quicklink h2 h3 blockquote mapomedia quicktable",
|
|
20
|
+
noneditable_noneditable_class: "mceNonEditable",
|
|
21
|
+
toolbar_mode: "sliding",
|
|
22
|
+
contextmenu: "link mapomedia table",
|
|
23
|
+
skin_url: isDark ? `${base}mapo/tinymce-skins/mapo-dark` : `${base}mapo/tinymce-skins/mapo-light`,
|
|
24
|
+
content_style: "body { font-family:Helvetica,Arial,sans-serif; font-size:14px }",
|
|
25
|
+
});
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
export default function (callback) {
|
|
2
2
|
const pluginmanager = window.tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const pluginname = "mapomedia"
|
|
4
|
+
pluginmanager.add(pluginname, function (editor, url) {
|
|
5
|
+
const conf = {
|
|
5
6
|
icon: 'image',
|
|
6
|
-
|
|
7
|
+
tooltip: 'Insert image/video/audio/docs',
|
|
7
8
|
onAction: () => callback().then(html => {
|
|
8
9
|
editor.focus();
|
|
9
10
|
editor.undoManager.transact(() => editor.selection.setContent(html))
|
|
10
11
|
editor.selection.setCursorLocation();
|
|
11
12
|
editor.nodeChanged();
|
|
12
13
|
}).catch(() => null)
|
|
13
|
-
}
|
|
14
|
+
}
|
|
14
15
|
editor.addCommand('mceMapoMedia', () => callback().then(html => {
|
|
15
16
|
editor.focus();
|
|
16
17
|
editor.undoManager.transact(() => editor.selection.setContent(html))
|
|
17
18
|
editor.selection.setCursorLocation();
|
|
18
19
|
editor.nodeChanged();
|
|
19
20
|
}).catch(() => null))
|
|
20
|
-
editor.ui.registry.addButton(
|
|
21
|
-
editor.ui.registry.addMenuItem(...conf);
|
|
21
|
+
editor.ui.registry.addButton(pluginname, conf);
|
|
22
|
+
editor.ui.registry.addMenuItem(pluginname, { text: "Mapo Media...", ...conf });
|
|
22
23
|
return {
|
|
23
24
|
getMetadata: function () {
|
|
24
25
|
return {
|