@mapomodule/uikit 1.0.0-alpha.9 → 1.0.0

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 (230) hide show
  1. package/CHANGELOG.md +853 -0
  2. package/components/ConfirmDialog.vue +58 -37
  3. package/components/Detail/Detail.vue +415 -285
  4. package/components/Detail/DetailLangSwitch.vue +8 -1
  5. package/components/DropArea.vue +62 -55
  6. package/components/Form/Form.vue +218 -0
  7. package/components/Form/FormField.vue +216 -0
  8. package/components/Form/FormGroup.vue +146 -0
  9. package/components/Form/FormTabs.vue +188 -0
  10. package/components/Form/defaults.js +98 -0
  11. package/components/Form/fields/ColorField.vue +79 -0
  12. package/components/{fields → Form/fields}/DateField.vue +12 -9
  13. package/components/Form/fields/DateTimeField.vue +271 -0
  14. package/components/Form/fields/EnhancedMediaField.vue +224 -0
  15. package/components/Form/fields/FileField.vue +125 -0
  16. package/components/Form/fields/FksField.vue +115 -0
  17. package/components/Form/fields/MediaField.vue +159 -0
  18. package/components/Form/fields/MediaM2mField.vue +149 -0
  19. package/components/Form/fields/Repeater.vue +618 -0
  20. package/components/{fields → Form/fields}/SeoPreview.vue +10 -10
  21. package/components/Form/fields/TimeField.vue +154 -0
  22. package/components/Form/fields/mapField/leaflet.injector.js +39 -0
  23. package/components/Form/fields/mapField/mapField.vue +350 -0
  24. package/components/Form/fields/wygEditor/defaults.js +25 -0
  25. package/components/{fields → Form/fields}/wygEditor/utils/mapomedia.plugin.js +7 -6
  26. package/components/{fields → Form/fields}/wygEditor/wygEditor.vue +114 -25
  27. package/components/Form/fields/wygEditorCKE/defaults.js +103 -0
  28. package/components/Form/fields/wygEditorCKE/utils/ckeditor.injector.js +29 -0
  29. package/components/Form/fields/wygEditorCKE/wygEditorCKE.vue +270 -0
  30. package/components/LangSwitcher.vue +44 -0
  31. package/components/List/List.vue +34 -17
  32. package/components/List/ListActions.vue +5 -5
  33. package/components/List/ListFilters.vue +48 -10
  34. package/components/List/ListHead.vue +1 -1
  35. package/components/List/ListQuickEdit.vue +28 -102
  36. package/components/List/ListTable.vue +89 -11
  37. package/components/Login.vue +5 -4
  38. package/components/LogoutButton.vue +43 -28
  39. package/components/MediaManager/MediaBreadcrumbs.vue +45 -0
  40. package/components/MediaManager/MediaEditor.vue +226 -195
  41. package/components/MediaManager/MediaFileChanger.vue +78 -0
  42. package/components/MediaManager/MediaFolders.vue +207 -183
  43. package/components/MediaManager/MediaGallery.vue +212 -137
  44. package/components/MediaManager/MediaManager.vue +97 -171
  45. package/components/MediaManager/MediaManagerDialog.vue +28 -20
  46. package/components/MediaManager/MediaPreview.vue +89 -11
  47. package/components/MediaManager/MediaUploader.vue +75 -77
  48. package/components/MenuManager/MenuManager.vue +332 -0
  49. package/components/MenuManager/MenuNodeEditor.vue +270 -0
  50. package/components/MenuManager/MenuTreeview.vue +237 -0
  51. package/components/MenuManager/MenuTreeviewNode.vue +208 -0
  52. package/components/PagePreview.vue +58 -0
  53. package/components/SnackBar.vue +2 -3
  54. package/components/ThemeToggle.vue +13 -0
  55. package/components/layout/Sidebar/Sidebar.vue +48 -39
  56. package/components/layout/Sidebar/SidebarList.vue +10 -5
  57. package/components/layout/Sidebar/SidebarListItem.vue +56 -15
  58. package/components/layout/Sidebar/SidebarProfile.vue +42 -0
  59. package/components/layout/Sidebar/SidebarTitle.vue +45 -0
  60. package/components/layout/Topbar/Topbar.vue +11 -9
  61. package/components/layout/routebuilder.js +2 -2
  62. package/defaults/i18n.js +37 -0
  63. package/defaults/vuetify.js +34 -0
  64. package/layouts/default.vue +33 -7
  65. package/layouts/empty.vue +10 -0
  66. package/module.js +7 -5
  67. package/package.json +6 -4
  68. package/pages/index.vue +19 -17
  69. package/static/mapo/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
  70. package/static/mapo/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
  71. package/static/mapo/ckeditor/plugins/image2/dev/contents.css +35 -0
  72. package/static/mapo/ckeditor/plugins/image2/dev/image2.html +338 -0
  73. package/static/mapo/ckeditor/plugins/image2/dialogs/image2.js +557 -0
  74. package/static/mapo/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
  75. package/static/mapo/ckeditor/plugins/image2/icons/image.png +0 -0
  76. package/static/mapo/ckeditor/plugins/image2/lang/af.js +21 -0
  77. package/static/mapo/ckeditor/plugins/image2/lang/ar.js +21 -0
  78. package/static/mapo/ckeditor/plugins/image2/lang/az.js +21 -0
  79. package/static/mapo/ckeditor/plugins/image2/lang/bg.js +21 -0
  80. package/static/mapo/ckeditor/plugins/image2/lang/bn.js +21 -0
  81. package/static/mapo/ckeditor/plugins/image2/lang/bs.js +21 -0
  82. package/static/mapo/ckeditor/plugins/image2/lang/ca.js +21 -0
  83. package/static/mapo/ckeditor/plugins/image2/lang/cs.js +21 -0
  84. package/static/mapo/ckeditor/plugins/image2/lang/cy.js +21 -0
  85. package/static/mapo/ckeditor/plugins/image2/lang/da.js +21 -0
  86. package/static/mapo/ckeditor/plugins/image2/lang/de-ch.js +21 -0
  87. package/static/mapo/ckeditor/plugins/image2/lang/de.js +21 -0
  88. package/static/mapo/ckeditor/plugins/image2/lang/el.js +21 -0
  89. package/static/mapo/ckeditor/plugins/image2/lang/en-au.js +21 -0
  90. package/static/mapo/ckeditor/plugins/image2/lang/en-ca.js +21 -0
  91. package/static/mapo/ckeditor/plugins/image2/lang/en-gb.js +21 -0
  92. package/static/mapo/ckeditor/plugins/image2/lang/en.js +21 -0
  93. package/static/mapo/ckeditor/plugins/image2/lang/eo.js +21 -0
  94. package/static/mapo/ckeditor/plugins/image2/lang/es-mx.js +21 -0
  95. package/static/mapo/ckeditor/plugins/image2/lang/es.js +21 -0
  96. package/static/mapo/ckeditor/plugins/image2/lang/et.js +21 -0
  97. package/static/mapo/ckeditor/plugins/image2/lang/eu.js +21 -0
  98. package/static/mapo/ckeditor/plugins/image2/lang/fa.js +21 -0
  99. package/static/mapo/ckeditor/plugins/image2/lang/fi.js +21 -0
  100. package/static/mapo/ckeditor/plugins/image2/lang/fo.js +21 -0
  101. package/static/mapo/ckeditor/plugins/image2/lang/fr-ca.js +21 -0
  102. package/static/mapo/ckeditor/plugins/image2/lang/fr.js +21 -0
  103. package/static/mapo/ckeditor/plugins/image2/lang/gl.js +21 -0
  104. package/static/mapo/ckeditor/plugins/image2/lang/gu.js +21 -0
  105. package/static/mapo/ckeditor/plugins/image2/lang/he.js +21 -0
  106. package/static/mapo/ckeditor/plugins/image2/lang/hi.js +21 -0
  107. package/static/mapo/ckeditor/plugins/image2/lang/hr.js +21 -0
  108. package/static/mapo/ckeditor/plugins/image2/lang/hu.js +21 -0
  109. package/static/mapo/ckeditor/plugins/image2/lang/id.js +21 -0
  110. package/static/mapo/ckeditor/plugins/image2/lang/is.js +21 -0
  111. package/static/mapo/ckeditor/plugins/image2/lang/it.js +21 -0
  112. package/static/mapo/ckeditor/plugins/image2/lang/ja.js +21 -0
  113. package/static/mapo/ckeditor/plugins/image2/lang/ka.js +21 -0
  114. package/static/mapo/ckeditor/plugins/image2/lang/km.js +21 -0
  115. package/static/mapo/ckeditor/plugins/image2/lang/ko.js +21 -0
  116. package/static/mapo/ckeditor/plugins/image2/lang/ku.js +21 -0
  117. package/static/mapo/ckeditor/plugins/image2/lang/lt.js +21 -0
  118. package/static/mapo/ckeditor/plugins/image2/lang/lv.js +21 -0
  119. package/static/mapo/ckeditor/plugins/image2/lang/mk.js +21 -0
  120. package/static/mapo/ckeditor/plugins/image2/lang/mn.js +21 -0
  121. package/static/mapo/ckeditor/plugins/image2/lang/ms.js +21 -0
  122. package/static/mapo/ckeditor/plugins/image2/lang/nb.js +21 -0
  123. package/static/mapo/ckeditor/plugins/image2/lang/nl.js +21 -0
  124. package/static/mapo/ckeditor/plugins/image2/lang/no.js +21 -0
  125. package/static/mapo/ckeditor/plugins/image2/lang/oc.js +21 -0
  126. package/static/mapo/ckeditor/plugins/image2/lang/pl.js +21 -0
  127. package/static/mapo/ckeditor/plugins/image2/lang/pt-br.js +21 -0
  128. package/static/mapo/ckeditor/plugins/image2/lang/pt.js +21 -0
  129. package/static/mapo/ckeditor/plugins/image2/lang/ro.js +21 -0
  130. package/static/mapo/ckeditor/plugins/image2/lang/ru.js +21 -0
  131. package/static/mapo/ckeditor/plugins/image2/lang/si.js +21 -0
  132. package/static/mapo/ckeditor/plugins/image2/lang/sk.js +21 -0
  133. package/static/mapo/ckeditor/plugins/image2/lang/sl.js +21 -0
  134. package/static/mapo/ckeditor/plugins/image2/lang/sq.js +21 -0
  135. package/static/mapo/ckeditor/plugins/image2/lang/sr-latn.js +21 -0
  136. package/static/mapo/ckeditor/plugins/image2/lang/sr.js +21 -0
  137. package/static/mapo/ckeditor/plugins/image2/lang/sv.js +21 -0
  138. package/static/mapo/ckeditor/plugins/image2/lang/th.js +21 -0
  139. package/static/mapo/ckeditor/plugins/image2/lang/tr.js +21 -0
  140. package/static/mapo/ckeditor/plugins/image2/lang/tt.js +21 -0
  141. package/static/mapo/ckeditor/plugins/image2/lang/ug.js +21 -0
  142. package/static/mapo/ckeditor/plugins/image2/lang/uk.js +21 -0
  143. package/static/mapo/ckeditor/plugins/image2/lang/vi.js +21 -0
  144. package/static/mapo/ckeditor/plugins/image2/lang/zh-cn.js +21 -0
  145. package/static/mapo/ckeditor/plugins/image2/lang/zh.js +21 -0
  146. package/static/mapo/ckeditor/plugins/image2/plugin.js +1798 -0
  147. package/static/mapo/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
  148. package/static/mapo/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
  149. package/static/mapo/ckeditor/plugins/image2/samples/image2.html +68 -0
  150. package/static/mapo/ckeditor/skins/moono/dev/icons16.png +0 -0
  151. package/static/mapo/ckeditor/skins/moono/dev/icons16.svg +2374 -0
  152. package/static/mapo/ckeditor/skins/moono/dev/icons32.png +0 -0
  153. package/static/mapo/ckeditor/skins/moono/dev/icons32.svg +2722 -0
  154. package/static/mapo/ckeditor/skins/moono/dev/locations.json +144 -0
  155. package/static/mapo/ckeditor/skins/moono/dialog.css +5 -0
  156. package/static/mapo/ckeditor/skins/moono/dialog_ie.css +5 -0
  157. package/static/mapo/ckeditor/skins/moono/dialog_ie7.css +5 -0
  158. package/static/mapo/ckeditor/skins/moono/dialog_ie8.css +5 -0
  159. package/static/mapo/ckeditor/skins/moono/dialog_iequirks.css +5 -0
  160. package/static/mapo/ckeditor/skins/moono/editor.css +5 -0
  161. package/static/mapo/ckeditor/skins/moono/editor_gecko.css +5 -0
  162. package/static/mapo/ckeditor/skins/moono/editor_ie.css +5 -0
  163. package/static/mapo/ckeditor/skins/moono/editor_ie7.css +5 -0
  164. package/static/mapo/ckeditor/skins/moono/editor_ie8.css +5 -0
  165. package/static/mapo/ckeditor/skins/moono/editor_iequirks.css +5 -0
  166. package/static/mapo/ckeditor/skins/moono/icons.png +0 -0
  167. package/static/mapo/ckeditor/skins/moono/icons_hidpi.png +0 -0
  168. package/static/mapo/ckeditor/skins/moono/images/anchor.png +0 -0
  169. package/static/mapo/ckeditor/skins/moono/images/arrow.png +0 -0
  170. package/static/mapo/ckeditor/skins/moono/images/close.png +0 -0
  171. package/static/mapo/ckeditor/skins/moono/images/hidpi/anchor.png +0 -0
  172. package/static/mapo/ckeditor/skins/moono/images/hidpi/close.png +0 -0
  173. package/static/mapo/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
  174. package/static/mapo/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
  175. package/static/mapo/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
  176. package/static/mapo/ckeditor/skins/moono/images/lock-open.png +0 -0
  177. package/static/mapo/ckeditor/skins/moono/images/lock.png +0 -0
  178. package/static/mapo/ckeditor/skins/moono/images/refresh.png +0 -0
  179. package/static/mapo/ckeditor/skins/moono/images/spinner.gif +0 -0
  180. package/static/mapo/ckeditor/skins/moono/readme.md +49 -0
  181. package/static/mapo/ckeditor/skins/moono/skin.js +10 -0
  182. package/static/mapo/ckeditor/skins/moono-dark/dialog.css +5 -0
  183. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie.css +5 -0
  184. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie7.css +5 -0
  185. package/static/mapo/ckeditor/skins/moono-dark/dialog_ie8.css +5 -0
  186. package/static/mapo/ckeditor/skins/moono-dark/dialog_iequirks.css +5 -0
  187. package/static/mapo/ckeditor/skins/moono-dark/editor.css +5 -0
  188. package/static/mapo/ckeditor/skins/moono-dark/editor_gecko.css +5 -0
  189. package/static/mapo/ckeditor/skins/moono-dark/editor_ie.css +5 -0
  190. package/static/mapo/ckeditor/skins/moono-dark/editor_ie7.css +5 -0
  191. package/static/mapo/ckeditor/skins/moono-dark/editor_ie8.css +5 -0
  192. package/static/mapo/ckeditor/skins/moono-dark/editor_iequirks.css +5 -0
  193. package/static/mapo/ckeditor/skins/moono-dark/icons.png +0 -0
  194. package/static/mapo/ckeditor/skins/moono-dark/icons_hidpi.png +0 -0
  195. package/static/mapo/ckeditor/skins/moono-dark/images/arrow.png +0 -0
  196. package/static/mapo/ckeditor/skins/moono-dark/images/close.png +0 -0
  197. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/close.png +0 -0
  198. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock-open.png +0 -0
  199. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock.png +0 -0
  200. package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/refresh.png +0 -0
  201. package/static/mapo/ckeditor/skins/moono-dark/images/lock-open.png +0 -0
  202. package/static/mapo/ckeditor/skins/moono-dark/images/lock.png +0 -0
  203. package/static/mapo/ckeditor/skins/moono-dark/images/refresh.png +0 -0
  204. package/static/mapo/ckeditor/skins/moono-dark/readme.md +51 -0
  205. package/static/mapo/ckeditor/skins/moono-dark/skin.js +5 -0
  206. package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
  207. package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
  208. package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
  209. package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
  210. package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
  211. package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
  212. package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
  213. package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
  214. package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
  215. package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
  216. package/translations/en-US.js +177 -0
  217. package/translations/it-IT.js +180 -0
  218. package/LICENSE.md +0 -20
  219. package/components/Detail/DetailField.vue +0 -142
  220. package/components/Detail/defaults.js +0 -57
  221. package/components/fields/FksField.vue +0 -60
  222. package/components/fields/MediaField.vue +0 -213
  223. package/components/fields/MediaM2mField.vue +0 -243
  224. package/components/fields/wygEditor/defaults.js +0 -55
  225. package/components/layout/Sidebar/SidebarFooter.vue +0 -71
  226. package/defaults.js +0 -29
  227. package/layouts/error.vue +0 -45
  228. /package/components/{fields → Form/fields}/wygEditor/utils/events.js +0 -0
  229. /package/components/{fields/wygEditor/utils/script.injector.js → Form/fields/wygEditor/utils/tinymce.injector.js} +0 -0
  230. /package/static/{favicon.ico → mapo/favicon.ico} +0 -0
@@ -1,65 +1,51 @@
1
1
  <template>
2
- <v-card elevation="0">
3
- <v-card-title class="d-flex flex-wrap-reverse pa-0">
4
- <div>
5
- <v-tabs v-model="tab" right background-color="transparent">
6
- <v-tab>Gallery</v-tab>
7
- <v-tab>Uploader</v-tab>
2
+ <div class="media-manager--wrapper">
3
+ <MediaFolders v-show="!editMedia" v-if="!noFolders" :mime="mime" />
4
+ <v-card elevation="0" class="media-manager--v-card" :class="{ transparent: !fillBackgroud, editing:editMedia }">
5
+ <v-card-title class="d-flex flex-wrap pa-0">
6
+ <div class="d-flex flex-grow-1">
7
+ <v-tabs v-model="tab" background-color="transparent" :show-arrows="false">
8
+ <v-tab>{{ $t("mapo.mediaManager.gallery") }}</v-tab>
9
+ <v-tab>{{ $t("mapo.mediaManager.uploader") }}</v-tab>
8
10
  </v-tabs>
11
+ <v-spacer></v-spacer>
12
+ <v-btn v-show="$vuetify.breakpoint.xs" class="ma-2 ml-auto" @click="getRoot" icon>
13
+ <v-icon>mdi-update</v-icon>
14
+ </v-btn>
9
15
  </div>
10
- <v-spacer></v-spacer>
11
- <v-text-field
12
- v-show="tab == 0"
16
+ <div class="d-flex ma-auto mr-0 pb-2 pb-sm-0" :style="$vuetify.breakpoint.xs ? 'width: 100%' : ''">
17
+ <v-text-field
18
+ v-show="!editMedia && tab == 0"
13
19
  v-model="searchValue"
14
20
  @input="
15
21
  loadingSearch = true;
16
22
  search();
17
23
  "
18
24
  prepend-inner-icon="mdi-magnify"
19
- label="Search"
25
+ :label="$t('mapo.search')"
20
26
  single-line
21
27
  hide-details
22
28
  outlined
23
29
  dense
24
30
  clearable
25
31
  :loading="loadingSearch"
26
- class="mx-2 shrink"
32
+ class="mx-2 mt-2 rounded-0"
27
33
  ></v-text-field>
28
- <v-btn class="ma-2" @click="getRoot" icon>
34
+ <v-btn v-show="!$vuetify.breakpoint.xs" class="ma-2 ml-0" @click="getRoot" icon>
29
35
  <v-icon>mdi-update</v-icon>
30
36
  </v-btn>
37
+ </div>
31
38
  </v-card-title>
32
- <v-card-text class="pa-0">
33
- <MediaFolders
34
- v-if="!noFolders"
35
- v-bind="{ folders, parentFolders, loading }"
36
- @updateFolder="updateOrCreateFolder($event)"
37
- @deleteFolder="deleteFolder($event)"
38
- @goToFolder="
39
- parentFolder = $event;
40
- getRoot();
41
- "
42
- />
43
- <v-tabs-items v-model="tab" class="transparent">
44
- <v-tab-item>
45
- <MediaGallery
46
- v-show="!editMedia"
47
- v-bind="{ select, page, pages, medias }"
48
- :selection="$attrs.selection"
49
- @update:selection="$emit('update:selection', $event)"
50
- @selectionChange="selectionChange($event)"
51
- @pageChange="getRoot({ page: $event })"
52
- @editMedia="openEditor($event)"
53
- />
54
- <MediaEditor
55
- v-model="editMedia"
56
- @deleteMedia="deleteMedia($event)"
57
- @updateMedia="updateMedia($event)"
58
- />
39
+ <v-progress-linear v-if="loading" indeterminate></v-progress-linear>
40
+ <MediaBreadcrumbs/>
41
+ <v-card-text class="media-manager--card-text pa-0">
42
+ <v-tabs-items touchless v-model="tab" class="transparent fill-height">
43
+ <v-tab-item class="fill-height">
44
+ <MediaGallery v-show="!editMedia"/>
45
+ <MediaEditor/>
59
46
  </v-tab-item>
60
- <v-tab-item>
47
+ <v-tab-item class="fill-height">
61
48
  <MediaUploader
62
- v-bind="{ folders, parentFolder }"
63
49
  @Upload="
64
50
  tab = 0;
65
51
  getRoot({ page: 1 });
@@ -68,44 +54,69 @@
68
54
  </v-tab-item>
69
55
  </v-tabs-items>
70
56
  </v-card-text>
71
- <v-card-actions>
57
+ <v-card-actions class="pa-0">
72
58
  <!-- Slot to provide custom button actions inside the media manager -->
73
59
  <slot name="actions"></slot>
74
60
  </v-card-actions>
75
61
  </v-card>
62
+ </div>
63
+
76
64
  </template>
65
+ <style lang="scss">
66
+ .v-card.media-manager--v-card{
67
+ display: flex;
68
+ flex-direction: column;
69
+ flex-grow: 1;
70
+ border-radius: 0px;
71
+ max-width: calc(100% - 56px);
72
+ &.editing{
73
+ max-width: 100%;
74
+ }
75
+ @media (max-width: 600px){
76
+ max-width: 100%;
77
+ }
78
+ }
79
+ .v-slide-group__next--disabled, .v-slide-group__prev--disabled{
80
+ display: none !important;
81
+ }
82
+ .media-manager--card-text{
83
+ max-height: calc(100vh - 100px);
84
+ min-height: 400px;
85
+ flex-grow: 1;
86
+ @media (max-width: 600px){
87
+ max-height: calc(100vh - 195px);
88
+ }
89
+ }
90
+ .v-dialog .media-manager--card-text{
91
+ max-height: calc(100vh - 300px);
92
+ }
93
+ .media-manager--wrapper{
94
+ display: flex;
95
+ height: inherit;
96
+ flex-direction: column-reverse;
97
+ position: relative;
98
+ justify-content: flex-end;
99
+ @media (min-width: 600px){
100
+ flex-direction: row;
101
+ }
102
+ }
103
+ </style>
77
104
 
78
105
  <script>
79
106
  import { debounce } from "@mapomodule/utils/helpers/debounce";
107
+ import { mapGetters, mapActions } from "vuex"
80
108
 
81
- const initialData = () => ({
82
- _mediaFolderCrud: null,
83
- _mediaFileCrud: null,
84
- medias: [],
85
- folders: [],
86
- parentFolders: [],
87
- page: 1,
88
- pages: 1,
89
- tab: 0,
90
- editMedia: null,
91
- loading: false,
92
- searchValue: "",
93
- loadingSearch: false,
94
- });
95
109
 
96
110
  export default {
97
111
  name: "MediaManager",
98
- data() {
99
- return initialData();
112
+ data(){
113
+ return {
114
+ tab: 0,
115
+ searchValue: "",
116
+ loadingSearch: false,
117
+ }
100
118
  },
101
119
  props: {
102
- select: {
103
- type: String,
104
- default: "none",
105
- validator(val) {
106
- return ["none", "single", "multi"].indexOf(val) !== -1;
107
- },
108
- },
109
120
  noFolders: {
110
121
  type: Boolean,
111
122
  default: false,
@@ -114,120 +125,35 @@ export default {
114
125
  type: String,
115
126
  required: false,
116
127
  },
128
+ fillBackgroud: Boolean
117
129
  },
118
- computed: {
119
- mediaFolderCrud() {
120
- this._mediaFolderCrud =
121
- this._mediaFolderCrud || this.$mapo.$api.crud("api/camomilla/media-folders");
122
- return this._mediaFolderCrud;
123
- },
124
- mediaFileCrud() {
125
- this._mediaFileCrud =
126
- this._mediaFileCrud || this.$mapo.$api.crud("api/camomilla/media");
127
- return this._mediaFileCrud;
128
- },
129
- parentFolder: {
130
- get() {
131
- return (
132
- (this.parentFolders.length &&
133
- this.parentFolders[this.parentFolders.length - 1]) ||
134
- null
135
- );
136
- },
137
- set(val) {
138
- if (!val || !val.path) {
139
- this.parentFolders = [];
140
- } else {
141
- const index = this.parentFolders.findIndex((f) => f.path == val.path);
142
- if (index == -1) {
143
- this.parentFolders.push(val);
144
- } else {
145
- this.parentFolders.splice(index + 1, this.parentFolders.length - (index + 1));
146
- }
147
- }
148
- },
149
- },
130
+ watch: {
131
+ '$i18n.locale': async function(locale) {
132
+ if (this.editMedia)
133
+ this.openEditor(this.editMedia);
134
+ }
150
135
  },
136
+ computed: mapGetters("mapo/media", ["parentFolder", "medias", "folders", "parentFolders", "page", "pages", "loading", "editMedia" ]),
151
137
  methods: {
152
- async getRoot(context) {
153
- this.loading = true;
154
- const { page, folder } = context || {};
155
- const { id } = folder || this.parentFolder || {};
156
- let response;
157
- this.page = page || this.page;
158
- const params = {
159
- page: this.page,
160
- search: this.searchValue || undefined,
161
- fltr: this.mime ? `mime_type=${this.mime}` : undefined,
162
- };
163
- if (id) {
164
- response = await this.mediaFolderCrud.detail(id, {
165
- params,
166
- });
167
- } else {
168
- response = await this.mediaFolderCrud.list({ params });
169
- }
170
- this.processResponse(response);
171
- this.loading = false;
172
- this.editMedia = null;
173
- },
174
-
175
- updateOrCreateFolder(folder) {
176
- return this.mediaFolderCrud.updateOrCreate(folder).then(() => this.getRoot());
177
- },
178
-
179
- deleteFolder(folder) {
180
- return this.mediaFolderCrud.delete(folder.id).then(() => this.getRoot());
181
- },
182
-
183
- deleteMedia(media) {
184
- return this.mediaFileCrud.delete(media.id).then(() => {
185
- (this.editMedia = null), this.getRoot();
186
- });
187
- },
188
-
189
- detailMedia(media_id) {
190
- return this.mediaFileCrud.detail(media_id);
191
- },
192
-
193
- async updateMedia(media) {
194
- const files = ["file", "objectURL", "thumbnail"];
195
- const payload = this.$mapo.$api.multipart(media, files);
196
- const conf = { headers: { "Content-Type": "multipart/form-data" } };
197
- const res = await this.mediaFileCrud.partialUpdate(media.id, payload, conf)
198
- if (media.file){
199
- this.medias = []
200
- await this.getRoot()
201
- }
202
- this.editMedia = res
203
- this.$mapo.$snack.open({
204
- message: "File info succesfully updated."
205
- })
206
- return res
207
- },
208
- processResponse(resp) {
209
- this.medias = resp?.media?.items || [];
210
- this.folders = resp?.folders || [];
211
- this.parentFolder = resp?.parent_folder;
212
- this.page = resp?.media?.paginator?.page;
213
- this.pages = resp?.media?.paginator?.pages;
214
- },
215
- selectionChange(event) {
216
- this.$emit("selectionChange", event);
217
- },
218
- async openEditor(event) {
219
- this.editMedia = await this.detailMedia(event.id);
220
- },
138
+ ...mapActions("mapo/media", ["getRoot", "openEditor", "updateMedia", "updateOrCreateFolder", "deleteFolder", "deleteMedia", "reset"]),
221
139
  search: debounce(function () {
222
- this.getRoot().then(() => (this.loadingSearch = false));
140
+ this.getRoot({search: this.searchValue, all: true}).then(() => (this.loadingSearch = false));
223
141
  }, 500),
224
- reset() {
225
- Object.assign(this.$data, initialData());
226
- this.getRoot();
227
- },
228
142
  },
229
143
  async fetch() {
144
+ this.$store.commit("mapo/media/SET_MIME_TYPE", this.mime || null);
230
145
  await this.getRoot();
231
146
  },
147
+ mounted(){
148
+ this.storeUnsubscribe = this.$store.subscribeAction((action) => {
149
+ if (action.type == "mapo/media/getRoot" && this.searchValue != action.payload?.search) {
150
+ this.searchValue = action.payload?.search;
151
+ }
152
+ });
153
+ },
154
+ destroyed(){
155
+ this.reset();
156
+ this.storeUnsubscribe && this.storeUnsubscribe()
157
+ }
232
158
  };
233
159
  </script>
@@ -1,32 +1,30 @@
1
1
  <template>
2
2
  <div>
3
- <slot v-bind="{ on, attrs }" name="activator"></slot>
4
- <v-dialog v-model="dialog" width="800" scrollable>
3
+ <slot v-bind="{ on, $attrs }" name="activator"></slot>
4
+ <v-dialog v-model="dialog" max-width="100%" width="800" scrollable>
5
5
  <media-manager
6
- @selectionChange="selectionChange($event)"
7
- :selection="$attrs.selection"
8
- @update:selection="$emit('update:selection', $event)"
9
- v-bind="{ select, noFolders, mime }"
6
+ v-if="dialog"
7
+ v-bind="{ noFolders, mime }"
10
8
  elevation="0"
11
- ref="mediaManager"
9
+ fill-backgroud
12
10
  >
13
11
  <template v-slot:actions>
14
12
  <v-spacer></v-spacer>
15
- <v-btn v-if="select == 'multi'" color="primary" text @click="done">done</v-btn>
13
+ <v-btn v-if="select == 'multi'" color="primary" text tile @click="done">{{ $t("mapo.confirm") }}</v-btn>
16
14
  </template>
17
15
  </media-manager>
18
16
  </v-dialog>
19
17
  </div>
20
18
  </template>
19
+
21
20
  <script>
21
+ import { mapGetters, mapActions } from "vuex"
22
+
22
23
  export default {
23
24
  name: "MediaManagerDialog",
24
25
  data() {
25
26
  return {
26
- selection: [],
27
27
  dialog: false,
28
- attrs: { ...this.$attrs },
29
- reset: false,
30
28
  on: {
31
29
  click: (event) => {
32
30
  event.preventDefault();
@@ -51,6 +49,9 @@ export default {
51
49
  return ["none", "single", "multi"].indexOf(val) !== -1;
52
50
  },
53
51
  },
52
+ selected: {
53
+ type: Object | Array | null,
54
+ },
54
55
  mime: {
55
56
  type: String,
56
57
  required: false
@@ -60,17 +61,30 @@ export default {
60
61
  value(val) {
61
62
  this.dialog = val;
62
63
  },
64
+ selected(val){
65
+ this.dialog && this.setSelection(val);
66
+ },
67
+ selection(val){
68
+ if (this.dialog && !(val?.id == this.selected?.id)){
69
+ this.done()
70
+ }
71
+ },
63
72
  dialog(val) {
73
+ if(val){
74
+ this.setSelectionMode(this.select).then(() => this.setSelection(this.selected));
75
+ }
64
76
  this.$emit("input", val);
65
77
  this.$emit(val ? "open" : "close");
66
78
  if (!val && this.reject) {
67
79
  this.reject();
68
80
  }
69
- if (val && this.reset) this.$refs.mediaManager.reset();
70
- this.reset = !val;
71
81
  },
72
82
  },
83
+ computed:{
84
+ ...mapGetters("mapo/media", ["selection", "selectMode"])
85
+ },
73
86
  methods: {
87
+ ...mapActions("mapo/media", ["setSelection", "setSelectionMode"]),
74
88
  open() {
75
89
  this.dialog = true;
76
90
  return new Promise((resolve, reject) => {
@@ -78,18 +92,12 @@ export default {
78
92
  this.reject = reject;
79
93
  });
80
94
  },
81
- selectionChange(event) {
82
- this.selection = event;
83
- if (this.select == "single") {
84
- this.done();
85
- }
86
- },
87
95
  done() {
88
96
  if (this.resolve) {
89
97
  this.resolve(this.selection);
90
98
  }
91
99
  this.dialog = false;
92
- this.$emit("selectionChange", this.selection);
100
+ this.$emit("update:selected", this.selection);
93
101
  },
94
102
  },
95
103
  };
@@ -1,21 +1,23 @@
1
1
  <template>
2
- <v-img
3
- :src="(media.is_image && media.file) || null"
4
- :lazy-src="(media.is_image && media.thumbnail) || null"
2
+ <v-img
3
+ :src="(isImage && media.file) || null"
4
+ :lazy-src="(isImage && media.thumbnail) || null"
5
5
  aspect-ratio="1"
6
6
  class="grey lighten-2"
7
7
  :class="{
8
- selected,
9
8
  'media-controls': mediaControls,
10
9
  'video-preview': videoPreview,
11
10
  }"
12
11
  v-bind="$attrs"
13
12
  v-on="videoListeners"
13
+ @mouseover.native="hover = true"
14
+ @mouseleave.native="hover = false; showInfo = false"
15
+ :title="media.title || media.name"
14
16
  >
15
17
  <template v-slot:placeholder>
16
18
  <v-row class="fill-height ma-0" align="center" justify="center">
17
19
  <v-progress-circular
18
- v-if="media.is_image"
20
+ v-if="isImage"
19
21
  indeterminate
20
22
  color="grey lighten-5"
21
23
  ></v-progress-circular>
@@ -67,10 +69,54 @@
67
69
  </div>
68
70
  </v-row>
69
71
  </template>
72
+ <template>
73
+ <div @click.stop="showInfo=true" class="file-info text-right" :class="{hover, showInfo}">
74
+ <span class="file-name text-truncate">{{ (filename && name) || undefined }}</span>
75
+ <span class="file-details text-caption " :class="{showInfo}">
76
+ <span>{{ dateCreated }}</span><br>
77
+ <span>{{ fileSize }}</span>
78
+ </span>
79
+ </div>
80
+ </template>
70
81
  </v-img>
71
82
  </template>
72
83
 
73
84
  <style lang="scss">
85
+ .file-info{
86
+ position: absolute;
87
+ bottom: 0;
88
+ padding: 0.2em 1em;
89
+ background: #1f1f1f;
90
+ opacity: 0;
91
+ transition: opacity .5s;
92
+ width: 100%;
93
+ display: block;
94
+ max-height: 80%;
95
+ overflow: auto ;
96
+ &.hover{
97
+ opacity: .7;
98
+ }
99
+ &.showInfo{
100
+ opacity: .9;
101
+ padding: 0.2em 0.5em;
102
+ .file-name{
103
+ font-weight: bold;
104
+ }
105
+ }
106
+ }
107
+ .file-name{
108
+ display: block;
109
+ }
110
+ .file-details{
111
+ max-height: 0;
112
+ overflow: hidden;
113
+ transition: all .5s;
114
+ display: block;
115
+ &.showInfo{
116
+ max-height: 500px;
117
+ overflow: auto;
118
+ }
119
+ }
74
120
  .v-image.media-controls {
75
121
  .v-image__placeholder {
76
122
  z-index: 0;
@@ -93,11 +139,21 @@
93
139
  </style>
94
140
 
95
141
  <script>
142
+ import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
143
+
144
+ const extensions = {
145
+ image: ["png", "jpg", "jpeg", "avif", "webp"],
146
+ audio: ["mp3", "ogg", "flac"],
147
+ video: ["mp4", "webm", "avi", "mov", "wmv"]
148
+ }
149
+
96
150
  export default {
97
151
  data() {
98
152
  return {
99
153
  playing: false,
100
154
  playPromise: null,
155
+ hover: false,
156
+ showInfo: false
101
157
  };
102
158
  },
103
159
  props: {
@@ -105,10 +161,6 @@ export default {
105
161
  type: Object,
106
162
  default: () => ({}),
107
163
  },
108
- selected: {
109
- type: Boolean,
110
- default: false,
111
- },
112
164
  filename: {
113
165
  type: Boolean,
114
166
  default: false,
@@ -139,22 +191,48 @@ export default {
139
191
  "70px"
140
192
  );
141
193
  },
194
+ isImage() {
195
+ if (this.media?.mime_type)
196
+ return this.media.mime_type.startsWith("image/");
197
+ return extensions.image.includes(this.media?.file?.split(".").pop()?.toLowerCase())
198
+ },
142
199
  isVideo() {
143
- return this.media.mime_type && this.media.mime_type.startsWith("video/");
200
+ if (this.media?.mime_type)
201
+ return this.media.mime_type.startsWith("video/");
202
+ return extensions.video.includes(this.media?.file?.split(".").pop()?.toLowerCase())
144
203
  },
145
204
  isAudio() {
146
- return this.media.mime_type && this.media.mime_type.startsWith("audio/");
205
+ if (this.media?.mime_type)
206
+ return this.media.mime_type.startsWith("audio/");
207
+ return extensions.audio.includes(this.media?.file?.split(".").pop()?.toLowerCase())
147
208
  },
148
209
  videoListeners() {
149
210
  if (this.isVideo && this.videoPreview) {
150
211
  return {
151
212
  mouseenter: this.startVideoPreview,
152
213
  mouseleave: this.stopVideoPreview,
214
+ touchstart: this.handleTouch
153
215
  };
154
216
  }
155
217
  },
218
+ fileSize() {
219
+ return this.media && humanFileSize(this.media.size);
220
+ },
221
+ dateCreated() {
222
+ return this.media && new Date(this.media.created).toLocaleDateString();
223
+ },
156
224
  },
157
225
  methods: {
226
+ handleTouch(event){
227
+ const video = this.$refs.video;
228
+ if (video && !this.playing) {
229
+ this.startVideoPreview()
230
+ event.preventDefault()
231
+ event.stopPropagation()
232
+ } else {
233
+ this.stopVideoPreview()
234
+ }
235
+ },
158
236
  startVideoPreview() {
159
237
  const video = this.$refs.video;
160
238
  if (video && !this.playing) {