@mapomodule/uikit 1.0.0 → 2.0.0-beta.1

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.
Files changed (266) hide show
  1. package/README.md +167 -0
  2. package/dist/index.d.cts +2 -0
  3. package/dist/index.d.mts +2 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.mjs +18 -0
  6. package/dist/module.d.cts +2 -0
  7. package/dist/module.d.mts +2 -0
  8. package/dist/module.d.ts +2 -0
  9. package/dist/module.json +9 -0
  10. package/dist/module.mjs +18 -0
  11. package/dist/types.d.mts +13 -0
  12. package/package.json +63 -12
  13. package/src/index.ts +10 -0
  14. package/src/module.ts +181 -0
  15. package/src/runtime/assets/main.css +59 -0
  16. package/src/runtime/components/MapoConfirmDialog.vue +34 -0
  17. package/src/runtime/components/MapoDetail.vue +861 -0
  18. package/src/runtime/components/MapoDetailLangSwitch.vue +166 -0
  19. package/src/runtime/components/MapoList.vue +339 -0
  20. package/src/runtime/components/MapoListActions.vue +152 -0
  21. package/src/runtime/components/MapoListFilters.vue +289 -0
  22. package/src/runtime/components/MapoListHead.vue +12 -0
  23. package/src/runtime/components/MapoListQuickEdit.vue +163 -0
  24. package/src/runtime/components/MapoListTable.vue +926 -0
  25. package/src/runtime/components/MapoListTabs.vue +48 -0
  26. package/src/runtime/components/MapoLogin.vue +209 -0
  27. package/src/runtime/components/MapoLogoutButton.vue +46 -0
  28. package/src/runtime/components/MapoRootComponents.vue +9 -0
  29. package/src/runtime/components/MapoSidebar.vue +112 -0
  30. package/src/runtime/components/MapoSidebarList.vue +35 -0
  31. package/src/runtime/components/MapoSidebarListItem.vue +79 -0
  32. package/src/runtime/components/MapoSidebarProfile.vue +57 -0
  33. package/src/runtime/components/MapoSnackBar.vue +42 -0
  34. package/src/runtime/components/MapoThemeToggle.vue +23 -0
  35. package/src/runtime/components/MapoTopbar.vue +36 -0
  36. package/src/runtime/layouts/default.vue +53 -0
  37. package/src/runtime/layouts/empty.vue +9 -0
  38. package/src/runtime/page-meta.nuxt.d.ts +45 -0
  39. package/src/runtime/pages/index.vue +14 -0
  40. package/src/runtime/pages/login.vue +7 -0
  41. package/src/runtime/types/list.ts +64 -0
  42. package/CHANGELOG.md +0 -1030
  43. package/assets/mixins.scss +0 -22
  44. package/assets/variables.scss +0 -18
  45. package/components/ConfirmDialog.vue +0 -173
  46. package/components/Detail/Detail.vue +0 -696
  47. package/components/Detail/DetailLangSwitch.vue +0 -79
  48. package/components/DropArea.vue +0 -257
  49. package/components/Form/Form.vue +0 -218
  50. package/components/Form/FormField.vue +0 -216
  51. package/components/Form/FormGroup.vue +0 -146
  52. package/components/Form/FormTabs.vue +0 -188
  53. package/components/Form/defaults.js +0 -98
  54. package/components/Form/fields/ColorField.vue +0 -79
  55. package/components/Form/fields/DateField.vue +0 -77
  56. package/components/Form/fields/DateTimeField.vue +0 -271
  57. package/components/Form/fields/EnhancedMediaField.vue +0 -224
  58. package/components/Form/fields/FileField.vue +0 -125
  59. package/components/Form/fields/FksField.vue +0 -115
  60. package/components/Form/fields/MediaField.vue +0 -159
  61. package/components/Form/fields/MediaM2mField.vue +0 -149
  62. package/components/Form/fields/Repeater.vue +0 -618
  63. package/components/Form/fields/SeoPreview.vue +0 -89
  64. package/components/Form/fields/TimeField.vue +0 -154
  65. package/components/Form/fields/mapField/leaflet.injector.js +0 -39
  66. package/components/Form/fields/mapField/mapField.vue +0 -350
  67. package/components/Form/fields/wygEditor/defaults.js +0 -25
  68. package/components/Form/fields/wygEditor/utils/events.js +0 -64
  69. package/components/Form/fields/wygEditor/utils/mapomedia.plugin.js +0 -32
  70. package/components/Form/fields/wygEditor/utils/tinymce.injector.js +0 -29
  71. package/components/Form/fields/wygEditor/wygEditor.vue +0 -285
  72. package/components/Form/fields/wygEditorCKE/defaults.js +0 -103
  73. package/components/Form/fields/wygEditorCKE/utils/ckeditor.injector.js +0 -29
  74. package/components/Form/fields/wygEditorCKE/wygEditorCKE.vue +0 -270
  75. package/components/LangSwitcher.vue +0 -44
  76. package/components/List/List.vue +0 -271
  77. package/components/List/ListActions.vue +0 -164
  78. package/components/List/ListFilters.vue +0 -372
  79. package/components/List/ListHead.vue +0 -67
  80. package/components/List/ListQuickEdit.vue +0 -228
  81. package/components/List/ListTable.vue +0 -484
  82. package/components/List/ListTabs.vue +0 -65
  83. package/components/Login.vue +0 -125
  84. package/components/Logo.vue +0 -79
  85. package/components/LogoutButton.vue +0 -54
  86. package/components/MediaManager/MediaBreadcrumbs.vue +0 -45
  87. package/components/MediaManager/MediaEditor.vue +0 -340
  88. package/components/MediaManager/MediaFileChanger.vue +0 -78
  89. package/components/MediaManager/MediaFolders.vue +0 -287
  90. package/components/MediaManager/MediaGallery.vue +0 -281
  91. package/components/MediaManager/MediaManager.vue +0 -159
  92. package/components/MediaManager/MediaManagerDialog.vue +0 -104
  93. package/components/MediaManager/MediaPreview.vue +0 -258
  94. package/components/MediaManager/MediaUploader.vue +0 -163
  95. package/components/MenuManager/MenuManager.vue +0 -332
  96. package/components/MenuManager/MenuNodeEditor.vue +0 -270
  97. package/components/MenuManager/MenuTreeview.vue +0 -237
  98. package/components/MenuManager/MenuTreeviewNode.vue +0 -208
  99. package/components/PagePreview.vue +0 -58
  100. package/components/RootComponents.vue +0 -25
  101. package/components/SnackBar.vue +0 -69
  102. package/components/ThemeToggle.vue +0 -13
  103. package/components/layout/Sidebar/Sidebar.vue +0 -89
  104. package/components/layout/Sidebar/SidebarList.vue +0 -49
  105. package/components/layout/Sidebar/SidebarListItem.vue +0 -185
  106. package/components/layout/Sidebar/SidebarProfile.vue +0 -42
  107. package/components/layout/Sidebar/SidebarTitle.vue +0 -45
  108. package/components/layout/Topbar/Topbar.vue +0 -29
  109. package/components/layout/routebuilder.js +0 -48
  110. package/defaults/i18n.js +0 -37
  111. package/defaults/vuetify.js +0 -34
  112. package/layouts/default.vue +0 -47
  113. package/layouts/empty.vue +0 -16
  114. package/module.js +0 -80
  115. package/pages/index.vue +0 -37
  116. package/pages/login.vue +0 -10
  117. package/static/mapo/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
  118. package/static/mapo/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
  119. package/static/mapo/ckeditor/plugins/image2/dev/contents.css +0 -35
  120. package/static/mapo/ckeditor/plugins/image2/dev/image2.html +0 -338
  121. package/static/mapo/ckeditor/plugins/image2/dialogs/image2.js +0 -557
  122. package/static/mapo/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
  123. package/static/mapo/ckeditor/plugins/image2/icons/image.png +0 -0
  124. package/static/mapo/ckeditor/plugins/image2/lang/af.js +0 -21
  125. package/static/mapo/ckeditor/plugins/image2/lang/ar.js +0 -21
  126. package/static/mapo/ckeditor/plugins/image2/lang/az.js +0 -21
  127. package/static/mapo/ckeditor/plugins/image2/lang/bg.js +0 -21
  128. package/static/mapo/ckeditor/plugins/image2/lang/bn.js +0 -21
  129. package/static/mapo/ckeditor/plugins/image2/lang/bs.js +0 -21
  130. package/static/mapo/ckeditor/plugins/image2/lang/ca.js +0 -21
  131. package/static/mapo/ckeditor/plugins/image2/lang/cs.js +0 -21
  132. package/static/mapo/ckeditor/plugins/image2/lang/cy.js +0 -21
  133. package/static/mapo/ckeditor/plugins/image2/lang/da.js +0 -21
  134. package/static/mapo/ckeditor/plugins/image2/lang/de-ch.js +0 -21
  135. package/static/mapo/ckeditor/plugins/image2/lang/de.js +0 -21
  136. package/static/mapo/ckeditor/plugins/image2/lang/el.js +0 -21
  137. package/static/mapo/ckeditor/plugins/image2/lang/en-au.js +0 -21
  138. package/static/mapo/ckeditor/plugins/image2/lang/en-ca.js +0 -21
  139. package/static/mapo/ckeditor/plugins/image2/lang/en-gb.js +0 -21
  140. package/static/mapo/ckeditor/plugins/image2/lang/en.js +0 -21
  141. package/static/mapo/ckeditor/plugins/image2/lang/eo.js +0 -21
  142. package/static/mapo/ckeditor/plugins/image2/lang/es-mx.js +0 -21
  143. package/static/mapo/ckeditor/plugins/image2/lang/es.js +0 -21
  144. package/static/mapo/ckeditor/plugins/image2/lang/et.js +0 -21
  145. package/static/mapo/ckeditor/plugins/image2/lang/eu.js +0 -21
  146. package/static/mapo/ckeditor/plugins/image2/lang/fa.js +0 -21
  147. package/static/mapo/ckeditor/plugins/image2/lang/fi.js +0 -21
  148. package/static/mapo/ckeditor/plugins/image2/lang/fo.js +0 -21
  149. package/static/mapo/ckeditor/plugins/image2/lang/fr-ca.js +0 -21
  150. package/static/mapo/ckeditor/plugins/image2/lang/fr.js +0 -21
  151. package/static/mapo/ckeditor/plugins/image2/lang/gl.js +0 -21
  152. package/static/mapo/ckeditor/plugins/image2/lang/gu.js +0 -21
  153. package/static/mapo/ckeditor/plugins/image2/lang/he.js +0 -21
  154. package/static/mapo/ckeditor/plugins/image2/lang/hi.js +0 -21
  155. package/static/mapo/ckeditor/plugins/image2/lang/hr.js +0 -21
  156. package/static/mapo/ckeditor/plugins/image2/lang/hu.js +0 -21
  157. package/static/mapo/ckeditor/plugins/image2/lang/id.js +0 -21
  158. package/static/mapo/ckeditor/plugins/image2/lang/is.js +0 -21
  159. package/static/mapo/ckeditor/plugins/image2/lang/it.js +0 -21
  160. package/static/mapo/ckeditor/plugins/image2/lang/ja.js +0 -21
  161. package/static/mapo/ckeditor/plugins/image2/lang/ka.js +0 -21
  162. package/static/mapo/ckeditor/plugins/image2/lang/km.js +0 -21
  163. package/static/mapo/ckeditor/plugins/image2/lang/ko.js +0 -21
  164. package/static/mapo/ckeditor/plugins/image2/lang/ku.js +0 -21
  165. package/static/mapo/ckeditor/plugins/image2/lang/lt.js +0 -21
  166. package/static/mapo/ckeditor/plugins/image2/lang/lv.js +0 -21
  167. package/static/mapo/ckeditor/plugins/image2/lang/mk.js +0 -21
  168. package/static/mapo/ckeditor/plugins/image2/lang/mn.js +0 -21
  169. package/static/mapo/ckeditor/plugins/image2/lang/ms.js +0 -21
  170. package/static/mapo/ckeditor/plugins/image2/lang/nb.js +0 -21
  171. package/static/mapo/ckeditor/plugins/image2/lang/nl.js +0 -21
  172. package/static/mapo/ckeditor/plugins/image2/lang/no.js +0 -21
  173. package/static/mapo/ckeditor/plugins/image2/lang/oc.js +0 -21
  174. package/static/mapo/ckeditor/plugins/image2/lang/pl.js +0 -21
  175. package/static/mapo/ckeditor/plugins/image2/lang/pt-br.js +0 -21
  176. package/static/mapo/ckeditor/plugins/image2/lang/pt.js +0 -21
  177. package/static/mapo/ckeditor/plugins/image2/lang/ro.js +0 -21
  178. package/static/mapo/ckeditor/plugins/image2/lang/ru.js +0 -21
  179. package/static/mapo/ckeditor/plugins/image2/lang/si.js +0 -21
  180. package/static/mapo/ckeditor/plugins/image2/lang/sk.js +0 -21
  181. package/static/mapo/ckeditor/plugins/image2/lang/sl.js +0 -21
  182. package/static/mapo/ckeditor/plugins/image2/lang/sq.js +0 -21
  183. package/static/mapo/ckeditor/plugins/image2/lang/sr-latn.js +0 -21
  184. package/static/mapo/ckeditor/plugins/image2/lang/sr.js +0 -21
  185. package/static/mapo/ckeditor/plugins/image2/lang/sv.js +0 -21
  186. package/static/mapo/ckeditor/plugins/image2/lang/th.js +0 -21
  187. package/static/mapo/ckeditor/plugins/image2/lang/tr.js +0 -21
  188. package/static/mapo/ckeditor/plugins/image2/lang/tt.js +0 -21
  189. package/static/mapo/ckeditor/plugins/image2/lang/ug.js +0 -21
  190. package/static/mapo/ckeditor/plugins/image2/lang/uk.js +0 -21
  191. package/static/mapo/ckeditor/plugins/image2/lang/vi.js +0 -21
  192. package/static/mapo/ckeditor/plugins/image2/lang/zh-cn.js +0 -21
  193. package/static/mapo/ckeditor/plugins/image2/lang/zh.js +0 -21
  194. package/static/mapo/ckeditor/plugins/image2/plugin.js +0 -1798
  195. package/static/mapo/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
  196. package/static/mapo/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
  197. package/static/mapo/ckeditor/plugins/image2/samples/image2.html +0 -68
  198. package/static/mapo/ckeditor/skins/moono/dev/icons16.png +0 -0
  199. package/static/mapo/ckeditor/skins/moono/dev/icons16.svg +0 -2374
  200. package/static/mapo/ckeditor/skins/moono/dev/icons32.png +0 -0
  201. package/static/mapo/ckeditor/skins/moono/dev/icons32.svg +0 -2722
  202. package/static/mapo/ckeditor/skins/moono/dev/locations.json +0 -144
  203. package/static/mapo/ckeditor/skins/moono/dialog.css +0 -5
  204. package/static/mapo/ckeditor/skins/moono/dialog_ie.css +0 -5
  205. package/static/mapo/ckeditor/skins/moono/dialog_ie7.css +0 -5
  206. package/static/mapo/ckeditor/skins/moono/dialog_ie8.css +0 -5
  207. package/static/mapo/ckeditor/skins/moono/dialog_iequirks.css +0 -5
  208. package/static/mapo/ckeditor/skins/moono/editor.css +0 -5
  209. package/static/mapo/ckeditor/skins/moono/editor_gecko.css +0 -5
  210. package/static/mapo/ckeditor/skins/moono/editor_ie.css +0 -5
  211. package/static/mapo/ckeditor/skins/moono/editor_ie7.css +0 -5
  212. package/static/mapo/ckeditor/skins/moono/editor_ie8.css +0 -5
  213. package/static/mapo/ckeditor/skins/moono/editor_iequirks.css +0 -5
  214. package/static/mapo/ckeditor/skins/moono/icons.png +0 -0
  215. package/static/mapo/ckeditor/skins/moono/icons_hidpi.png +0 -0
  216. package/static/mapo/ckeditor/skins/moono/images/anchor.png +0 -0
  217. package/static/mapo/ckeditor/skins/moono/images/arrow.png +0 -0
  218. package/static/mapo/ckeditor/skins/moono/images/close.png +0 -0
  219. package/static/mapo/ckeditor/skins/moono/images/hidpi/anchor.png +0 -0
  220. package/static/mapo/ckeditor/skins/moono/images/hidpi/close.png +0 -0
  221. package/static/mapo/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
  222. package/static/mapo/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
  223. package/static/mapo/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
  224. package/static/mapo/ckeditor/skins/moono/images/lock-open.png +0 -0
  225. package/static/mapo/ckeditor/skins/moono/images/lock.png +0 -0
  226. package/static/mapo/ckeditor/skins/moono/images/refresh.png +0 -0
  227. package/static/mapo/ckeditor/skins/moono/images/spinner.gif +0 -0
  228. package/static/mapo/ckeditor/skins/moono/readme.md +0 -49
  229. package/static/mapo/ckeditor/skins/moono/skin.js +0 -10
  230. package/static/mapo/ckeditor/skins/moono-dark/dialog.css +0 -5
  231. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie.css +0 -5
  232. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie7.css +0 -5
  233. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie8.css +0 -5
  234. package/static/mapo/ckeditor/skins/moono-dark/dialog_iequirks.css +0 -5
  235. package/static/mapo/ckeditor/skins/moono-dark/editor.css +0 -5
  236. package/static/mapo/ckeditor/skins/moono-dark/editor_gecko.css +0 -5
  237. package/static/mapo/ckeditor/skins/moono-dark/editor_ie.css +0 -5
  238. package/static/mapo/ckeditor/skins/moono-dark/editor_ie7.css +0 -5
  239. package/static/mapo/ckeditor/skins/moono-dark/editor_ie8.css +0 -5
  240. package/static/mapo/ckeditor/skins/moono-dark/editor_iequirks.css +0 -5
  241. package/static/mapo/ckeditor/skins/moono-dark/icons.png +0 -0
  242. package/static/mapo/ckeditor/skins/moono-dark/icons_hidpi.png +0 -0
  243. package/static/mapo/ckeditor/skins/moono-dark/images/arrow.png +0 -0
  244. package/static/mapo/ckeditor/skins/moono-dark/images/close.png +0 -0
  245. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/close.png +0 -0
  246. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock-open.png +0 -0
  247. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock.png +0 -0
  248. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/refresh.png +0 -0
  249. package/static/mapo/ckeditor/skins/moono-dark/images/lock-open.png +0 -0
  250. package/static/mapo/ckeditor/skins/moono-dark/images/lock.png +0 -0
  251. package/static/mapo/ckeditor/skins/moono-dark/images/refresh.png +0 -0
  252. package/static/mapo/ckeditor/skins/moono-dark/readme.md +0 -51
  253. package/static/mapo/ckeditor/skins/moono-dark/skin.js +0 -5
  254. package/static/mapo/favicon.ico +0 -0
  255. package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +0 -7
  256. package/static/mapo/tinymce-skins/mapo-dark/content.min.css +0 -7
  257. package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +0 -7
  258. package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +0 -7
  259. package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +0 -7
  260. package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +0 -7
  261. package/static/mapo/tinymce-skins/mapo-light/content.min.css +0 -7
  262. package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +0 -7
  263. package/static/mapo/tinymce-skins/mapo-light/skin.min.css +0 -7
  264. package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +0 -7
  265. package/translations/en-US.js +0 -177
  266. package/translations/it-IT.js +0 -180
@@ -1,154 +0,0 @@
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>
@@ -1,39 +0,0 @@
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
- }
@@ -1,350 +0,0 @@
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
- default: () => [],
123
- },
124
- // This label will be shown at the top of the editor.
125
- label: String,
126
- // This set the component status to readonly, stopping the user interaction.
127
- readonly: {
128
- type: Boolean,
129
- default: false,
130
- },
131
- // This set the component status to multiple, allowing the user to add multiple points. Pass it into attrs
132
- multiple: {
133
- type: Boolean,
134
- default: false,
135
- },
136
- fields: {
137
- // [`Array<FieldConfiguration>`](/components/Detail/Detail/#fieldconfiguration)
138
- type: Array | Object,
139
- default: () => [],
140
- },
141
- // Puts the input in an error state and passes through custom error messages.
142
- errorMessages: {
143
- type: Array,
144
- default: () => [],
145
- },
146
- },
147
- data() {
148
- return {
149
- model: this.value || [],
150
- map: null,
151
- searchQuery: "",
152
- markers: [],
153
- };
154
- },
155
- watch: {
156
- value(val) {
157
- this.model = val || [];
158
- },
159
- model(val) {
160
- this.$emit("input", val);
161
- },
162
- },
163
- mounted() {
164
- injectScript().then(this.initMap);
165
- },
166
- methods: {
167
- initMap() {
168
- const coordinates = this.model || [];
169
- if (coordinates.length > 0) {
170
- const { lat, lon } = coordinates[coordinates.length - 1];
171
- this.map = L.map(this.$refs.map).setView([lat, lon], 12);
172
- coordinates.forEach((point, index) => {
173
- const marker = L.marker([point.lat, point.lon]).addTo(this.map);
174
- this.markers[index] = marker;
175
- });
176
- this.map.fitBounds(coordinates.map((point) => [point.lat, point.lon]));
177
- } else {
178
- this.map = L.map(this.$refs.map).setView([0, 0], 2);
179
- }
180
- L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
181
- attribution: "© OpenStreetMap contributors",
182
- }).addTo(this.map);
183
- this.handleClickOnMap();
184
- },
185
- handleClickOnMap() {
186
- this.map.on("click", async (event) => {
187
- const coordinates = event.latlng;
188
-
189
- if (!this.multiple) {
190
- this.removeAllMarkers();
191
- this.model = [];
192
- }
193
-
194
- this.model.push({
195
- lat: coordinates.lat,
196
- lon: coordinates.lng,
197
- pointName: "",
198
- extra_fields: {},
199
- });
200
-
201
- const marker = L.marker([coordinates.lat, coordinates.lng]).addTo(
202
- this.map
203
- );
204
- this.markers.push(marker);
205
- await this.reverseGeoCoding(coordinates.lat, coordinates.lng);
206
- });
207
- },
208
- removeAllMarkers() {
209
- this.markers.forEach((marker) => this.map.removeLayer(marker));
210
- this.markers = [];
211
- },
212
- async reverseGeoCoding(lat, lon) {
213
- const reverseGeocodingResponse = await this.$axios.get(
214
- "https://nominatim.openstreetmap.org/reverse",
215
- {
216
- params: {
217
- lat,
218
- lon,
219
- format: "json",
220
- addressdetails: 1,
221
- "accept-language": this.$attrs.currentLang || "en",
222
- },
223
- }
224
- );
225
-
226
- if (
227
- reverseGeocodingResponse.data &&
228
- reverseGeocodingResponse.data.display_name
229
- ) {
230
- this.model[this.currentIndex].pointName =
231
- reverseGeocodingResponse.data.display_name;
232
- } else {
233
- this.model[this.currentIndex].pointName = this.searchQuery;
234
- }
235
- },
236
- removePointFromModel(index) {
237
- this.map.removeLayer(this.markers[index]);
238
- this.markers.splice(index, 1);
239
- this.model.splice(index, 1);
240
-
241
- if (this.model.length > 0) {
242
- this.map.fitBounds(this.model.map((point) => [point.lat, point.lon]));
243
- } else {
244
- this.map.setView([0, 0], 2);
245
- }
246
- },
247
- async searchLocation() {
248
- try {
249
- const response = await this.$axios.get(
250
- "https://nominatim.openstreetmap.org/search",
251
- {
252
- params: {
253
- q: this.searchQuery,
254
- format: "json",
255
- limit: 1,
256
- },
257
- }
258
- );
259
-
260
- if (response.data.length > 0) {
261
- if (!this.multiple) {
262
- this.removeAllMarkers();
263
- this.model = [];
264
- }
265
- const { lat, lon } = response.data[0];
266
- this.map.setView([lat, lon], 12);
267
-
268
- const marker = L.marker([lat, lon]).addTo(this.map);
269
- this.markers.push(marker);
270
-
271
- this.model.push({
272
- lat,
273
- lon,
274
- pointName: this.searchQuery,
275
- extra_fields: {},
276
- });
277
-
278
- await this.reverseGeoCoding(lat, lon);
279
- this.map.fitBounds(this.model.map((point) => [point.lat, point.lon]));
280
- }
281
- } catch (error) {
282
- console.error(`${this.$t("mapo.error.searchError")}: `, error);
283
- }
284
- },
285
- debouncedSearchLocation: debounce(function () {
286
- this.searchLocation();
287
- }, 500),
288
- getErrors(index) {
289
- return (this.errorMessages[index]) || {};
290
- },
291
- getFields(model) {
292
- if (this.hasTemplates) {
293
- const template = this.templates.find(
294
- (t) => model[t.tCodeField] == t.tCode
295
- );
296
- return template ? template.fields : [];
297
- }
298
- return this.fields;
299
- },
300
- templateSlots(model, slots) {
301
- if (this.hasTemplates) {
302
- const template = this.templates.find(
303
- (t) => model[t.tCodeField] == t.tCode
304
- );
305
- return nameSpacedSlots(slots, `template.${template.tCode}.`).reduce(
306
- (acc, v) => ({ [`template.${template.tCode}.${v}`]: v, ...acc }),
307
- {}
308
- );
309
- }
310
- return Object.keys(slots).reduce((acc, v) => ({ [v]: v, ...acc }), {});
311
- },
312
- },
313
- computed: {
314
- lat() {
315
- return this.model?.lat || "";
316
- },
317
- lon() {
318
- return this.model?.lon || "";
319
- },
320
- pointName() {
321
- return this.model?.pointName || "";
322
- },
323
- currentIndex() {
324
- return this.model.length > 0 ? this.model.length - 1 : 0;
325
- },
326
- hasTemplates() {
327
- return typeof this.fields == "object" && !Array.isArray(this.fields);
328
- },
329
- hasErrors () { return this.errorMessages && this.errorMessages.length },
330
- templates() {
331
- const templates = {};
332
- if (this.hasTemplates) {
333
- Object.keys(this.fields).forEach((tKey) => {
334
- const tValue = this.fields[tKey];
335
- const { preview, description } = tValue;
336
- templates[tKey] = {
337
- fields: tValue.fields || tValue,
338
- name: tValue.name || titleCase(tKey.replace(/_/, " ")),
339
- tCode: tValue.tCode || tKey,
340
- tCodeField: tValue.tCodeField || "tCode",
341
- preview,
342
- description,
343
- };
344
- });
345
- }
346
- return Object.values(templates);
347
- },
348
- },
349
- };
350
- </script>
@@ -1,25 +0,0 @@
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,64 +0,0 @@
1
- export default [
2
- 'Activate',
3
- 'AddUndo',
4
- 'BeforeAddUndo',
5
- 'BeforeExecCommand',
6
- 'BeforeGetContent',
7
- 'BeforeRenderUI',
8
- 'BeforeSetContent',
9
- 'BeforePaste',
10
- 'Blur',
11
- 'Change',
12
- 'ClearUndos',
13
- 'Click',
14
- 'ContextMenu',
15
- 'Copy',
16
- 'Cut',
17
- 'Dblclick',
18
- 'Deactivate',
19
- 'Dirty',
20
- 'Drag',
21
- 'DragDrop',
22
- 'DragEnd',
23
- 'DragGesture',
24
- 'DragOver',
25
- 'Drop',
26
- 'ExecCommand',
27
- 'Focus',
28
- 'FocusIn',
29
- 'FocusOut',
30
- 'GetContent',
31
- 'Hide',
32
- 'Init',
33
- 'KeyDown',
34
- 'KeyPress',
35
- 'KeyUp',
36
- 'LoadContent',
37
- 'MouseDown',
38
- 'MouseEnter',
39
- 'MouseLeave',
40
- 'MouseMove',
41
- 'MouseOut',
42
- 'MouseOver',
43
- 'MouseUp',
44
- 'NodeChange',
45
- 'ObjectResizeStart',
46
- 'ObjectResized',
47
- 'ObjectSelected',
48
- 'Paste',
49
- 'PostProcess',
50
- 'PostRender',
51
- 'PreProcess',
52
- 'ProgressState',
53
- 'Redo',
54
- 'Remove',
55
- 'Reset',
56
- 'SaveContent',
57
- 'SelectionChange',
58
- 'SetAttrib',
59
- 'SetContent',
60
- 'Show',
61
- 'Submit',
62
- 'Undo',
63
- 'VisualAid'
64
- ];
@@ -1,32 +0,0 @@
1
- export default function (callback) {
2
- const pluginmanager = window.tinymce.util.Tools.resolve('tinymce.PluginManager');
3
- const pluginname = "mapomedia"
4
- pluginmanager.add(pluginname, function (editor, url) {
5
- const conf = {
6
- icon: 'image',
7
- tooltip: 'Insert image/video/audio/docs',
8
- onAction: () => callback().then(html => {
9
- editor.focus();
10
- editor.undoManager.transact(() => editor.selection.setContent(html))
11
- editor.selection.setCursorLocation();
12
- editor.nodeChanged();
13
- }).catch(() => null)
14
- }
15
- editor.addCommand('mceMapoMedia', () => callback().then(html => {
16
- editor.focus();
17
- editor.undoManager.transact(() => editor.selection.setContent(html))
18
- editor.selection.setCursorLocation();
19
- editor.nodeChanged();
20
- }).catch(() => null))
21
- editor.ui.registry.addButton(pluginname, conf);
22
- editor.ui.registry.addMenuItem(pluginname, { text: "Mapo Media...", ...conf });
23
- return {
24
- getMetadata: function () {
25
- return {
26
- name: "Mapo Media",
27
- };
28
- }
29
- };
30
- }
31
- );
32
- }
@@ -1,29 +0,0 @@
1
- export default async function () {
2
- return new Promise((resolve, reject) => {
3
- if (typeof window.tinymce !== 'undefined'){
4
- resolve()
5
- }
6
- let scriptTag = document.getElementById("tinymce-script") || null
7
- const handler = () => {
8
- scriptTag.removeEventListener('load', handler);
9
- resolve()
10
- };
11
- if (!scriptTag) {
12
- try {
13
- scriptTag = document.createElement('script');
14
- scriptTag.referrerPolicy = 'origin';
15
- scriptTag.type = 'application/javascript';
16
- scriptTag.id = 'tinymce-script';
17
- scriptTag.src = "https://cdn.tiny.cloud/1/y3orc2on59mn794gzviet9lpuj9sr051d0045ir9bmrixn3o/tinymce/5/tinymce.min.js";
18
- // scriptTag.src = "https://cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js";
19
- scriptTag.async = true
20
- scriptTag.addEventListener('load', handler);
21
- document.head.appendChild(scriptTag);
22
- } catch (error) {
23
- reject(error)
24
- }
25
- } else {
26
- scriptTag.addEventListener('load', handler);
27
- }
28
- })
29
- }