@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.
Files changed (230) hide show
  1. package/CHANGELOG.md +892 -0
  2. package/components/ConfirmDialog.vue +58 -37
  3. package/components/Detail/Detail.vue +450 -243
  4. package/components/Detail/DetailLangSwitch.vue +9 -2
  5. package/components/DropArea.vue +63 -56
  6. package/components/Form/Form.vue +218 -0
  7. package/components/Form/FormField.vue +214 -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 +20 -11
  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 +88 -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 +596 -0
  20. package/components/Form/fields/SeoPreview.vue +89 -0
  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 +348 -0
  24. package/components/Form/fields/wygEditor/defaults.js +25 -0
  25. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/mapomedia.plugin.js +7 -6
  26. package/components/Form/fields/wygEditor/wygEditor.vue +285 -0
  27. package/components/Form/fields/wygEditorCKE/defaults.js +100 -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 +103 -51
  32. package/components/List/ListActions.vue +23 -5
  33. package/components/List/ListFilters.vue +166 -114
  34. package/components/List/ListHead.vue +30 -12
  35. package/components/List/ListQuickEdit.vue +130 -61
  36. package/components/List/ListTable.vue +210 -66
  37. package/components/Login.vue +17 -7
  38. package/components/LogoutButton.vue +43 -28
  39. package/components/MediaManager/MediaBreadcrumbs.vue +45 -0
  40. package/components/MediaManager/MediaEditor.vue +297 -120
  41. package/components/MediaManager/MediaFileChanger.vue +78 -0
  42. package/components/MediaManager/MediaFolders.vue +224 -116
  43. package/components/MediaManager/MediaGallery.vue +224 -145
  44. package/components/MediaManager/MediaManager.vue +125 -159
  45. package/components/MediaManager/MediaManagerDialog.vue +36 -31
  46. package/components/MediaManager/MediaPreview.vue +258 -0
  47. package/components/MediaManager/MediaUploader.vue +91 -90
  48. package/components/MenuManager/MenuManager.vue +332 -0
  49. package/components/MenuManager/MenuNodeEditor.vue +255 -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 +5 -7
  54. package/components/ThemeToggle.vue +13 -0
  55. package/components/layout/Sidebar/Sidebar.vue +61 -30
  56. package/components/layout/Sidebar/SidebarList.vue +19 -15
  57. package/components/layout/Sidebar/SidebarListItem.vue +122 -38
  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 -42
  61. package/components/layout/routebuilder.js +3 -3
  62. package/defaults/i18n.js +37 -0
  63. package/defaults/vuetify.js +34 -0
  64. package/layouts/default.vue +33 -18
  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 -18
  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/components/Detail/DetailField.vue +0 -129
  219. package/components/Detail/defaults.js +0 -50
  220. package/components/fields/M2mField.vue +0 -95
  221. package/components/fields/MediaField.vue +0 -195
  222. package/components/fields/MediaM2mField.vue +0 -238
  223. package/components/fields/TinyMce/TinyMce.vue +0 -177
  224. package/components/fields/TinyMce/defaults.js +0 -55
  225. package/components/layout/Sidebar/SidebarFooter.vue +0 -75
  226. package/defaults.js +0 -29
  227. package/layouts/error.vue +0 -45
  228. /package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/events.js +0 -0
  229. /package/components/{fields/TinyMce/utils/script.injector.js → Form/fields/wygEditor/utils/tinymce.injector.js} +0 -0
  230. /package/static/{favicon.ico → mapo/favicon.ico} +0 -0
@@ -1,193 +1,159 @@
1
1
  <template>
2
- <v-card v-bind="{ light, dark, elevation }">
3
- <div v-if="!editMedia" class="d-flex">
4
- <div class="d-flex">
5
- <v-btn class="ma-2" @click="getRoot" icon>
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>
10
+ </v-tabs>
11
+ <v-spacer></v-spacer>
12
+ <v-btn v-show="$vuetify.breakpoint.xs" class="ma-2 ml-auto" @click="getRoot" icon>
6
13
  <v-icon>mdi-update</v-icon>
7
14
  </v-btn>
8
- <v-btn
9
- v-if="parentFolder"
10
- class="ma-2"
11
- @click="getRoot({ folder: { id: parentFolder.updir } })"
12
- icon
13
- >
14
- <v-icon>mdi-arrow-left</v-icon>
15
- </v-btn>
16
- <span class="ma-2 d-flex align-center">{{
17
- parentFolder ? parentFolder.path : "/"
18
- }}</span>
19
15
  </div>
20
- <v-spacer></v-spacer>
21
- <div>
22
- <v-tabs v-model="tab" right background-color="transparent">
23
- <v-tab>Gallery</v-tab>
24
- <v-tab>Uploader</v-tab>
25
- </v-tabs>
26
- </div>
27
- </div>
28
-
29
- <div v-if="!editMedia">
30
- <MediaFolders
31
- v-if="!noFolders"
32
- v-bind="{ folders, parentFolder }"
33
- @updateFolder="updateOrCreateFolder($event)"
34
- @deleteFolder="deleteFolder($event)"
35
- @goToFolder="
36
- parentFolder = $event;
37
- getRoot();
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"
19
+ v-model="searchValue"
20
+ @input="
21
+ loadingSearch = true;
22
+ search();
38
23
  "
39
- />
40
- <v-divider v-if="!noFolders" class="mb-4"></v-divider>
41
-
42
- <v-tabs-items v-model="tab" class="transparent">
43
- <v-tab-item>
44
- <MediaGallery
45
- v-bind="{ select, page, pages, medias }"
46
- @selectionChange="selectionChange($event)"
47
- @pageChange="getRoot({ page: $event })"
48
- @editMedia="openEditor($event)"
49
- />
24
+ prepend-inner-icon="mdi-magnify"
25
+ :label="$t('mapo.search')"
26
+ single-line
27
+ hide-details
28
+ outlined
29
+ dense
30
+ clearable
31
+ :loading="loadingSearch"
32
+ class="mx-2 mt-2 rounded-0"
33
+ ></v-text-field>
34
+ <v-btn v-show="!$vuetify.breakpoint.xs" class="ma-2 ml-0" @click="getRoot" icon>
35
+ <v-icon>mdi-update</v-icon>
36
+ </v-btn>
37
+ </div>
38
+ </v-card-title>
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/>
50
46
  </v-tab-item>
51
- <v-tab-item>
47
+ <v-tab-item class="fill-height">
52
48
  <MediaUploader
53
- v-bind="{ folders, parentFolder }"
54
- @Upload="getRoot({ page: 1 })"
49
+ @Upload="
50
+ tab = 0;
51
+ getRoot({ page: 1 });
52
+ "
55
53
  />
56
54
  </v-tab-item>
57
55
  </v-tabs-items>
58
- </div>
59
- <MediaEditor
60
- v-model="editMedia"
61
- @deleteMedia="deleteMedia($event)"
62
- @updateMedia="updateMedia($event)"
63
- />
56
+ </v-card-text>
57
+ <v-card-actions class="pa-0">
58
+ <!-- Slot to provide custom button actions inside the media manager -->
59
+ <slot name="actions"></slot>
60
+ </v-card-actions>
64
61
  </v-card>
62
+ </div>
63
+
65
64
  </template>
66
-
67
- <style lang="scss" scoped>
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
+ }
68
103
  </style>
69
104
 
70
105
  <script>
71
- import MediaFolders from './MediaFolders.vue';
106
+ import { debounce } from "@mapomodule/utils/helpers/debounce";
107
+ import { mapGetters, mapActions } from "vuex"
108
+
109
+
72
110
  export default {
73
111
  name: "MediaManager",
74
- components: { MediaFolders },
75
- data() {
112
+ data(){
76
113
  return {
77
- _mediaFolderCrud: null,
78
- _mediaFileCrud: null,
79
- medias: [],
80
- folders: [],
81
- parentFolder: null,
82
- page: 1,
83
- pages: 1,
84
- tab: null,
85
- editMedia: null,
86
- };
114
+ tab: 0,
115
+ searchValue: "",
116
+ loadingSearch: false,
117
+ }
87
118
  },
88
119
  props: {
89
- select: {
90
- type: String,
91
- default: "none",
92
- validator(val) {
93
- return ["none", "single", "multi"].indexOf(val) !== -1;
94
- },
95
- },
96
120
  noFolders: {
97
121
  type: Boolean,
98
122
  default: false,
99
123
  },
100
- light: {
101
- type: Boolean,
102
- default: false,
103
- },
104
- dark: {
105
- type: Boolean,
106
- default: false,
107
- },
108
- elevation: {
109
- type: Number | String,
110
- default: undefined,
124
+ mime: {
125
+ type: String,
126
+ required: false,
111
127
  },
128
+ fillBackgroud: Boolean
112
129
  },
113
- computed: {
114
- mediaFolderCrud() {
115
- this._mediaFolderCrud =
116
- this._mediaFolderCrud ||
117
- this.$mapo.$api.crud("api/camomilla/media-folders");
118
- return this._mediaFolderCrud;
119
- },
120
- mediaFileCrud() {
121
- this._mediaFileCrud =
122
- this._mediaFileCrud || this.$mapo.$api.crud("api/camomilla/media");
123
- return this._mediaFileCrud;
124
- },
130
+ watch: {
131
+ '$i18n.locale': async function(locale) {
132
+ if (this.editMedia)
133
+ this.openEditor(this.editMedia);
134
+ }
125
135
  },
136
+ computed: mapGetters("mapo/media", ["parentFolder", "medias", "folders", "parentFolders", "page", "pages", "loading", "editMedia" ]),
126
137
  methods: {
127
- getRoot: async function (context) {
128
- const { page, folder } = context || {};
129
- const { id } = folder || this.parentFolder || {};
130
- let response;
131
- this.page = page || this.page;
132
- const params = { page: this.page };
133
- if (id) {
134
- response = await this.mediaFolderCrud.detail(id, {
135
- params,
136
- });
137
- } else {
138
- response = await this.mediaFolderCrud.list({ params });
139
- }
140
- this.processResponse(response);
141
- },
142
-
143
- updateOrCreateFolder(folder) {
144
- return this.mediaFolderCrud
145
- .updateOrCreate(folder)
146
- .then(() => this.getRoot());
147
- },
148
-
149
- deleteFolder(folder) {
150
- return this.mediaFolderCrud.delete(folder.id).then(() => this.getRoot());
151
- },
152
-
153
- deleteMedia(media) {
154
- return this.mediaFileCrud.delete(media.id).then(() => {
155
- (this.editMedia = null), this.getRoot();
156
- });
157
- },
158
-
159
- detailMedia(media_id) {
160
- return this.mediaFileCrud.detail(media_id);
161
- },
162
-
163
- updateMedia(media) {
164
- const files = ["file", "objectURL", "thumbnail"];
165
- const payload = this.$mapo.$api.multipart(media, files);
166
- const conf = { headers: { "Content-Type": "multipart/form-data" } };
167
- return this.mediaFileCrud
168
- .partialUpdate(media.id, payload, conf)
169
- .then(() =>
170
- this.$mapo.$snack.open({
171
- message: "file info succesfully updated.",
172
- })
173
- );
174
- },
175
- processResponse(resp) {
176
- this.medias = resp?.media?.items || [];
177
- this.folders = resp?.folders || [];
178
- this.parentFolder = resp?.parent_folder;
179
- this.page = resp?.media?.paginator?.page;
180
- this.pages = resp?.media?.paginator?.pages;
181
- },
182
- selectionChange(event) {
183
- this.$emit("selectionChange", event);
184
- },
185
- async openEditor(event) {
186
- this.editMedia = await this.detailMedia(event.id);
187
- },
138
+ ...mapActions("mapo/media", ["getRoot", "openEditor", "updateMedia", "updateOrCreateFolder", "deleteFolder", "deleteMedia", "reset"]),
139
+ search: debounce(function () {
140
+ this.getRoot({search: this.searchValue, all: true}).then(() => (this.loadingSearch = false));
141
+ }, 500),
188
142
  },
189
143
  async fetch() {
144
+ this.$store.commit("mapo/media/SET_MIME_TYPE", this.mime || null);
190
145
  await this.getRoot();
191
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
+ }
192
158
  };
193
159
  </script>
@@ -1,29 +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">
5
- <v-card v-bind="{ light, dark, elevation }">
6
- <MediaManager
7
- @selectionChange="selectionChange($event)"
8
- v-bind="{ select, noFolders, light, dark }"
9
- elevation="0"
10
- />
11
- <v-card-actions v-if="select == 'multi'">
3
+ <slot v-bind="{ on, $attrs }" name="activator"></slot>
4
+ <v-dialog v-model="dialog" max-width="100%" width="800" scrollable>
5
+ <media-manager
6
+ v-if="dialog"
7
+ v-bind="{ noFolders, mime }"
8
+ elevation="0"
9
+ fill-backgroud
10
+ >
11
+ <template v-slot:actions>
12
12
  <v-spacer></v-spacer>
13
- <v-btn color="primary" text @click="done">done</v-btn>
14
- </v-card-actions>
15
- </v-card>
13
+ <v-btn v-if="select == 'multi'" color="primary" text tile @click="done">{{ $t("mapo.confirm") }}</v-btn>
14
+ </template>
15
+ </media-manager>
16
16
  </v-dialog>
17
17
  </div>
18
18
  </template>
19
+
19
20
  <script>
21
+ import { mapGetters, mapActions } from "vuex"
22
+
20
23
  export default {
21
24
  name: "MediaManagerDialog",
22
25
  data() {
23
26
  return {
24
- selection: [],
25
27
  dialog: false,
26
- attrs: { ...this.$attrs },
27
28
  on: {
28
29
  click: (event) => {
29
30
  event.preventDefault();
@@ -48,24 +49,30 @@ export default {
48
49
  return ["none", "single", "multi"].indexOf(val) !== -1;
49
50
  },
50
51
  },
51
- light: {
52
- type: Boolean,
53
- default: false,
52
+ selected: {
53
+ type: Object | Array | null,
54
54
  },
55
- dark: {
56
- type: Boolean,
57
- default: false,
58
- },
59
- elevation: {
60
- type: Number | String,
61
- default: undefined,
55
+ mime: {
56
+ type: String,
57
+ required: false
62
58
  },
63
59
  },
64
60
  watch: {
65
61
  value(val) {
66
62
  this.dialog = val;
67
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
+ },
68
72
  dialog(val) {
73
+ if(val){
74
+ this.setSelectionMode(this.select).then(() => this.setSelection(this.selected));
75
+ }
69
76
  this.$emit("input", val);
70
77
  this.$emit(val ? "open" : "close");
71
78
  if (!val && this.reject) {
@@ -73,7 +80,11 @@ export default {
73
80
  }
74
81
  },
75
82
  },
83
+ computed:{
84
+ ...mapGetters("mapo/media", ["selection", "selectMode"])
85
+ },
76
86
  methods: {
87
+ ...mapActions("mapo/media", ["setSelection", "setSelectionMode"]),
77
88
  open() {
78
89
  this.dialog = true;
79
90
  return new Promise((resolve, reject) => {
@@ -81,18 +92,12 @@ export default {
81
92
  this.reject = reject;
82
93
  });
83
94
  },
84
- selectionChange(event) {
85
- this.selection = event;
86
- if (this.select == "single") {
87
- this.done();
88
- }
89
- },
90
95
  done() {
91
96
  if (this.resolve) {
92
97
  this.resolve(this.selection);
93
98
  }
94
99
  this.dialog = false;
95
- this.$emit("selectionChange", this.selection);
100
+ this.$emit("update:selected", this.selection);
96
101
  },
97
102
  },
98
103
  };
@@ -0,0 +1,258 @@
1
+ <template>
2
+ <v-img
3
+ :src="(isImage && media.file) || null"
4
+ :lazy-src="(isImage && media.thumbnail) || null"
5
+ aspect-ratio="1"
6
+ class="grey lighten-2"
7
+ :class="{
8
+ 'media-controls': mediaControls,
9
+ 'video-preview': videoPreview,
10
+ }"
11
+ v-bind="$attrs"
12
+ v-on="videoListeners"
13
+ @mouseover.native="hover = true"
14
+ @mouseleave.native="hover = false; showInfo = false"
15
+ :title="media.title || media.name"
16
+ >
17
+ <template v-slot:placeholder>
18
+ <v-row class="fill-height ma-0" align="center" justify="center">
19
+ <v-progress-circular
20
+ v-if="isImage"
21
+ indeterminate
22
+ color="grey lighten-5"
23
+ ></v-progress-circular>
24
+ <div
25
+ class="d-flex justify-center align-center"
26
+ :class="{ playing }"
27
+ style="width: 100%; height: 100%"
28
+ v-else-if="isVideo"
29
+ >
30
+ <video
31
+ :width="$attrs.contain && '100%'"
32
+ height="100%"
33
+ ref="video"
34
+ :controls="mediaControls"
35
+ >
36
+ <source :src="media.file" :type="media.mime_type" />
37
+ </video>
38
+ <v-icon
39
+ v-if="!mediaControls"
40
+ :size="size"
41
+ color="grey darken-4"
42
+ class="grey lighten-2 rounded-circle video-preview-icon"
43
+ >mdi-play</v-icon
44
+ >
45
+ </div>
46
+ <div
47
+ class="
48
+ d-flex
49
+ flex-column
50
+ align-center
51
+ justify-space-between
52
+ fill-height
53
+ "
54
+ style="width: 100%"
55
+ v-else
56
+ >
57
+ <div></div>
58
+ <v-icon :size="size" color="grey darken-2">
59
+ {{ isAudio ? "mdi-headphones" : "mdi-file" }}
60
+ </v-icon>
61
+ <audio v-if="isAudio && mediaControls" controls>
62
+ <source :src="media.file" :type="media.mime_type" />
63
+ </audio>
64
+ <span
65
+ class="grey--text text--darken-3 text-truncate pl-1 pr-8"
66
+ style="width: 100%"
67
+ >{{ (filename && name) || undefined }}</span
68
+ >
69
+ </div>
70
+ </v-row>
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>
81
+ </v-img>
82
+ </template>
83
+
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
+ }
120
+ .v-image.media-controls {
121
+ .v-image__placeholder {
122
+ z-index: 0;
123
+ }
124
+ }
125
+ .v-image.video-preview {
126
+ .v-image__placeholder {
127
+ height: calc(100% + 1px);
128
+ }
129
+ }
130
+ .video-preview-icon.v-icon.v-icon {
131
+ position: absolute;
132
+ opacity: 0.5;
133
+ transition: transform 0.3s ease-out, opacity 0.3s ease-out;
134
+ }
135
+ .playing .video-preview-icon.v-icon.v-icon {
136
+ opacity: 0;
137
+ transform: scale(1.2);
138
+ }
139
+ </style>
140
+
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
+
150
+ export default {
151
+ data() {
152
+ return {
153
+ playing: false,
154
+ playPromise: null,
155
+ hover: false,
156
+ showInfo: false
157
+ };
158
+ },
159
+ props: {
160
+ media: {
161
+ type: Object,
162
+ default: () => ({}),
163
+ },
164
+ filename: {
165
+ type: Boolean,
166
+ default: false,
167
+ },
168
+ iconSize: {
169
+ type: String || Number,
170
+ default: "70px",
171
+ },
172
+ videoPreview: {
173
+ type: Boolean,
174
+ default: false,
175
+ },
176
+ mediaControls: {
177
+ type: Boolean,
178
+ default: false,
179
+ },
180
+ },
181
+ computed: {
182
+ name() {
183
+ return this.media && this.media.file && this.media.file.split("/").pop();
184
+ },
185
+ size() {
186
+ return (
187
+ (this.iconSize &&
188
+ (typeof this.iconSize == "string"
189
+ ? this.iconSize
190
+ : this.iconSize + "px")) ||
191
+ "70px"
192
+ );
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
+ },
199
+ isVideo() {
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())
203
+ },
204
+ isAudio() {
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())
208
+ },
209
+ videoListeners() {
210
+ if (this.isVideo && this.videoPreview) {
211
+ return {
212
+ mouseenter: this.startVideoPreview,
213
+ mouseleave: this.stopVideoPreview,
214
+ touchstart: this.handleTouch
215
+ };
216
+ }
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
+ },
224
+ },
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
+ },
236
+ startVideoPreview() {
237
+ const video = this.$refs.video;
238
+ if (video && !this.playing) {
239
+ video.loop = true;
240
+ video.muted = true;
241
+ video.currentTime = 1;
242
+ this.playPromise = video.play().then(() => (this.playing = true));
243
+ }
244
+ },
245
+ async stopVideoPreview() {
246
+ if (this.playPromise) {
247
+ await this.playPromise;
248
+ }
249
+ const video = this.$refs.video;
250
+ if (video && this.playing) {
251
+ video.currentTime = 0;
252
+ video.pause();
253
+ this.playing = false;
254
+ }
255
+ },
256
+ },
257
+ };
258
+ </script>