@mapomodule/uikit 1.0.0-alpha.4 → 1.0.0-alpha.40

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 (80) hide show
  1. package/CHANGELOG.md +730 -0
  2. package/components/ConfirmDialog.vue +12 -16
  3. package/components/Detail/Detail.vue +406 -272
  4. package/components/Detail/DetailLangSwitch.vue +7 -2
  5. package/components/DropArea.vue +63 -56
  6. package/components/Form/Form.vue +218 -0
  7. package/components/Form/FormField.vue +213 -0
  8. package/components/Form/FormGroup.vue +146 -0
  9. package/components/Form/FormTabs.vue +188 -0
  10. package/components/Form/defaults.js +91 -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/EnhancedMediaField.vue +224 -0
  14. package/components/Form/fields/FileField.vue +125 -0
  15. package/components/Form/fields/FksField.vue +88 -0
  16. package/components/Form/fields/MediaField.vue +159 -0
  17. package/components/Form/fields/MediaM2mField.vue +149 -0
  18. package/components/Form/fields/Repeater.vue +593 -0
  19. package/components/Form/fields/SeoPreview.vue +89 -0
  20. package/components/Form/fields/wygEditor/defaults.js +25 -0
  21. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/events.js +0 -0
  22. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/mapomedia.plugin.js +7 -6
  23. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/script.injector.js +0 -0
  24. package/components/Form/fields/wygEditor/wygEditor.vue +285 -0
  25. package/components/LangSwitcher.vue +44 -0
  26. package/components/List/List.vue +119 -42
  27. package/components/List/ListActions.vue +60 -21
  28. package/components/List/ListFilters.vue +166 -114
  29. package/components/List/ListHead.vue +30 -12
  30. package/components/List/ListQuickEdit.vue +130 -61
  31. package/components/List/ListTable.vue +292 -80
  32. package/components/Login.vue +17 -7
  33. package/components/LogoutButton.vue +42 -28
  34. package/components/MediaManager/MediaBreadcrumbs.vue +45 -0
  35. package/components/MediaManager/MediaEditor.vue +282 -121
  36. package/components/MediaManager/MediaFolders.vue +169 -116
  37. package/components/MediaManager/MediaGallery.vue +151 -146
  38. package/components/MediaManager/MediaManager.vue +117 -159
  39. package/components/MediaManager/MediaManagerDialog.vue +36 -31
  40. package/components/MediaManager/MediaPreview.vue +203 -0
  41. package/components/MediaManager/MediaUploader.vue +55 -43
  42. package/components/SnackBar.vue +5 -7
  43. package/components/ThemeToggle.vue +13 -0
  44. package/components/layout/Sidebar/Sidebar.vue +61 -30
  45. package/components/layout/Sidebar/SidebarList.vue +19 -15
  46. package/components/layout/Sidebar/SidebarListItem.vue +111 -39
  47. package/components/layout/Sidebar/SidebarProfile.vue +42 -0
  48. package/components/layout/Sidebar/SidebarTitle.vue +45 -0
  49. package/components/layout/Topbar/Topbar.vue +11 -42
  50. package/components/layout/routebuilder.js +3 -3
  51. package/defaults/i18n.js +37 -0
  52. package/defaults/vuetify.js +34 -0
  53. package/layouts/default.vue +33 -18
  54. package/layouts/empty.vue +10 -0
  55. package/module.js +7 -5
  56. package/package.json +6 -4
  57. package/pages/index.vue +19 -18
  58. package/static/{favicon.ico → mapo/favicon.ico} +0 -0
  59. package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
  60. package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
  61. package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
  62. package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
  63. package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
  64. package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
  65. package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
  66. package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
  67. package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
  68. package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
  69. package/translations/en-US.js +134 -0
  70. package/translations/it-IT.js +136 -0
  71. package/components/Detail/DetailField.vue +0 -129
  72. package/components/Detail/defaults.js +0 -50
  73. package/components/fields/M2mField.vue +0 -95
  74. package/components/fields/MediaField.vue +0 -195
  75. package/components/fields/MediaM2mField.vue +0 -238
  76. package/components/fields/TinyMce/TinyMce.vue +0 -177
  77. package/components/fields/TinyMce/defaults.js +0 -55
  78. package/components/layout/Sidebar/SidebarFooter.vue +0 -75
  79. package/defaults.js +0 -29
  80. package/layouts/error.vue +0 -45
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <div
3
+ v-if="parentFolders && parentFolders.length"
4
+ class="media-breadcrumbs--wrapper"
5
+ >
6
+ <span class="mx-2 mt-1 d-flex flex-wrap align-center">
7
+ <span class="mb-1">
8
+ <v-icon @click="getRoot({ folder: null })" small>mdi-home</v-icon></span
9
+ >
10
+ <span
11
+ class="media-breadcrumbs--button"
12
+ v-for="(folder, i) in parentFolders"
13
+ :key="i"
14
+ >/<a @click="getRoot({ folder })">{{ folder.slug }}</a>
15
+ </span>
16
+ </span>
17
+ </div>
18
+ </template>
19
+
20
+ <style lang="scss" scoped>
21
+ .media-breadcrumbs--button {
22
+ padding-left: 7px;
23
+ color: grey;
24
+ a {
25
+ margin-left: 7px;
26
+ }
27
+ &:last-child {
28
+ a {
29
+ color: unset;
30
+ cursor: auto;
31
+ pointer-events: none;
32
+ }
33
+ }
34
+ }
35
+ </style>
36
+
37
+ <script>
38
+ import { mapGetters, mapActions } from "vuex";
39
+
40
+ export default {
41
+ name: "MediaBreadcrumbs",
42
+ computed: {...mapGetters("mapo/media", ["parentFolders"])},
43
+ methods: {...mapActions("mapo/media", ["getRoot"])},
44
+ };
45
+ </script>
@@ -1,163 +1,324 @@
1
1
  <template>
2
- <div v-if="media">
3
- <div class="d-flex align-center justify-space-between">
4
- <v-btn class="ma-2" @click="close" icon>
5
- <v-icon>mdi-arrow-left</v-icon>
6
- </v-btn>
7
- <span class="subtitle-2">{{ fileName }}</span>
8
- <div></div>
9
- </div>
10
- <v-container class="px-6">
11
- <v-img
12
- :src="media.file"
13
- :lazy-src="media.thumbnail"
14
- max-height="300"
2
+ <div v-if="media" class="media-editor--wrapper">
3
+ <div class="img_overlay">
4
+ <v-btn class="img_overlay__button img_overlay__button--back" small icon @click="closeEditor">
5
+ <v-icon>mdi-arrow-left</v-icon>
6
+ </v-btn>
7
+ <v-btn class="img_overlay__button img_overlay__button--href" small icon :href="media.file" target="_blank" >
8
+ <v-icon>mdi-open-in-new</v-icon>
9
+ </v-btn>
10
+ </div>
11
+ <MediaPreview
12
+ :media="media"
15
13
  contain
16
- aspect-ratio="1"
17
- class="grey lighten-2 mb-4 elevation-2"
18
- >
19
- <template v-slot:placeholder>
20
- <v-row class="fill-height ma-0" align="center" justify="center">
21
- <v-progress-circular
22
- indeterminate
23
- color="grey lighten-5"
24
- ></v-progress-circular>
25
- </v-row>
26
- </template>
27
- </v-img>
28
- <v-row class="flex-md-row-reverse">
29
- <v-col md="6" cols="12" class="info-media">
30
- <table class="text-caption fill-height pb-md-10">
31
- <tr>
32
- <td class="pr-3"><b>Filename:</b></td>
33
- <td>{{ fileName }}</td>
34
- </tr>
35
- <tr>
36
- <td class="pr-3"><b>Extension:</b></td>
37
- <td>{{ extension }}</td>
38
- </tr>
39
- <tr>
40
- <td class="pr-3"><b>Created:</b></td>
41
- <td>{{ dateCreated }}</td>
42
- </tr>
43
- <tr>
44
- <td class="pr-3"><b>Size:</b></td>
45
- <td>{{ fileSize }}</td>
46
- </tr>
47
- <tr>
48
- <td class="pr-3"><b>Url:</b></td>
49
- <td>
50
- <a :href="media.file" target="_blank">{{ media.file }}</a>
51
- </td>
52
- </tr>
53
- <tr>
54
- <td class="pr-3"><b>Linked models:</b></td>
55
- <td>{{ media.liks }}</td>
56
- </tr>
57
- </table>
58
- </v-col>
59
- <v-col md="6" cols="12">
60
- <v-row>
61
- <v-col sm="6" md="12" cols="12">
62
- <v-text-field
63
- dense
64
- v-model="media.name"
65
- label="Name"
66
- ></v-text-field>
67
- </v-col>
68
- <v-col sm="6" md="12" cols="12">
69
- <v-text-field
70
- dense
71
- v-model="media.title"
72
- label="Title"
73
- ></v-text-field>
74
- </v-col>
75
- <v-col sm="6" md="12" cols="12">
76
- <v-text-field
77
- dense
78
- v-model="media.description"
79
- label="Description"
80
- ></v-text-field>
81
- </v-col>
82
- <v-col sm="6" md="12" cols="12">
83
- <v-text-field
84
- dense
85
- v-model="media.alt_text"
86
- label="Alt name"
87
- ></v-text-field>
88
- </v-col>
89
- </v-row>
90
- <div class="d-flex justify-end">
91
- <v-btn text color="primary" @click="saveMedia">
92
- <v-icon left> mdi-upload </v-icon>
93
- save
14
+ filename
15
+ media-controls
16
+ class="media-editor--preview elevation-2"
17
+ />
18
+ <v-overlay
19
+ absolute
20
+ v-model="editing"
21
+ @click="editing = false"
22
+ ></v-overlay>
23
+ <div class="dialog">
24
+ <div class="dialog__container">
25
+ <v-card flat tile class="dialog__content overflow-y-auto"
26
+ :class="{ 'py-0': !editing }"
27
+ :max-height="editing ? height : '0px'"
28
+ >
29
+ <v-card-text class="flex-grow-0">
30
+ <v-row class="flex-md-row-reverse">
31
+ <v-col md="6" cols="12" class="info-media">
32
+ <table class="text-caption fill-height pb-md-10">
33
+ <tr>
34
+ <td class="pr-3"><b>{{ $t("mapo.fileName") }}:</b></td>
35
+ <td>{{ fileName }}</td>
36
+ </tr>
37
+ <tr>
38
+ <td class="pr-3"><b>{{ $t("mapo.mime") }}:</b></td>
39
+ <td>{{ media.mime_type }}</td>
40
+ </tr>
41
+ <tr>
42
+ <td class="pr-3"><b>{{ $t("mapo.created") }}:</b></td>
43
+ <td>{{ dateCreated }}</td>
44
+ </tr>
45
+ <tr>
46
+ <td class="pr-3"><b>{{ $t("mapo.size") }}:</b></td>
47
+ <td>{{ fileSize }}</td>
48
+ </tr>
49
+ <tr>
50
+ <td class="pr-3"><b>URL:</b></td>
51
+ <td>
52
+ <a :href="media.file" target="_blank">{{ media.file }}</a>
53
+ </td>
54
+ </tr>
55
+ <tr>
56
+ <td class="pr-3"><b>{{ $t("mapo.linkedModels") }}:</b></td>
57
+ <td>
58
+ <ul>
59
+ <li v-for="link in media.links" :key="link.id">
60
+ <b>{{link.model}} (id:{{link.id}})</b> - {{link.name}}
61
+ </li>
62
+ </ul>
63
+ </td>
64
+ </tr>
65
+ </table>
66
+ </v-col>
67
+ <v-col md="6" cols="12">
68
+ <v-row>
69
+ <v-col sm="6" md="12" cols="12">
70
+ <v-text-field
71
+ dense
72
+ v-model="media.name"
73
+ :label="$t('mapo.name')"
74
+ ></v-text-field>
75
+ </v-col>
76
+ <v-col sm="6" md="12" cols="12">
77
+ <v-text-field
78
+ dense
79
+ v-model="media.title"
80
+ :label="$t('mapo.titleTag')"
81
+ ></v-text-field>
82
+ </v-col>
83
+ <v-col sm="6" md="12" cols="12">
84
+ <v-text-field
85
+ dense
86
+ v-model="media.description"
87
+ :label="$t('mapo.description')"
88
+ ></v-text-field>
89
+ </v-col>
90
+ <v-col sm="6" md="12" cols="12">
91
+ <v-text-field
92
+ dense
93
+ v-model="media.alt_text"
94
+ :label="$t('mapo.altTag')"
95
+ ></v-text-field>
96
+ </v-col>
97
+ <v-col sm="6" md="12" cols="12" class="d-flex align-center">
98
+ <div class="d-flex flex-column flex-grow-1">
99
+ <v-file-input
100
+ v-model="newFile"
101
+ :accept="accept"
102
+ :label="$t('mapo.mediaEditor.changeFile')"
103
+ show-size
104
+ dense
105
+ prepend-icon
106
+ ></v-file-input>
107
+ <v-checkbox
108
+ v-if="newFile"
109
+ v-model="sameUrl"
110
+ :label="$t('mapo.mediaEditor.maintainOldUrl')"
111
+ class="ma-0"
112
+ hide-details
113
+ dense
114
+ ></v-checkbox>
115
+ </div>
116
+ <v-img
117
+ v-if="newFile && newFilePreview"
118
+ :src="newFilePreview"
119
+ aspect-ratio="1"
120
+ min-width="70px"
121
+ max-width="110px"
122
+ class="grey lighten-2 ml-3"
123
+ >
124
+ <template v-slot:placeholder>
125
+ <v-row
126
+ class="fill-height ma-0"
127
+ align="center"
128
+ justify="center"
129
+ >
130
+ <v-progress-circular
131
+ indeterminate
132
+ color="grey lighten-5"
133
+ ></v-progress-circular>
134
+ </v-row>
135
+ </template>
136
+ </v-img>
137
+ </v-col>
138
+ </v-row>
139
+ </v-col>
140
+ </v-row>
141
+ </v-card-text>
142
+ </v-card>
143
+ <v-btn
144
+ tile
145
+ depressed
146
+ width="100%"
147
+ :class="{ 'pr-0': editing }"
148
+ @click="editing = !editing"
149
+ >
150
+ <span>{{ $t("mapo.edit") }}</span>
151
+ <v-icon :style="rotate">mdi-chevron-up</v-icon>
152
+ <div class="edit_spacer" :class="{ 'flex-grow-1': editing }"></div>
153
+ <v-btn v-if="editing" text tile color="primary" @click="saveMedia">
154
+ {{ $t("mapo.save") }}
94
155
  </v-btn>
95
- <v-btn text color="error" @click="deleteMedia">
96
- <v-icon left> mdi-delete </v-icon>
97
- delete
156
+ <v-btn
157
+ v-if="editing"
158
+ text
159
+ tile
160
+ color="error"
161
+ @click.stop="confirmDelete"
162
+ >
163
+ {{ $t("mapo.delete") }}
98
164
  </v-btn>
99
- </div>
100
- </v-col>
101
- </v-row>
102
- </v-container>
165
+ </v-btn>
166
+ </div>
167
+ </div>
103
168
  </div>
104
169
  </template>
170
+
105
171
  <style lang="scss" scoped>
172
+
173
+ .media-editor--wrapper{
174
+ height: 100%;
175
+ display: flex;
176
+ flex-direction: column;
177
+ justify-content: space-between;
178
+ }
179
+
106
180
  table tr td:nth-child(2) {
107
181
  overflow-wrap: anywhere;
108
182
  }
183
+ .dialog {
184
+ position: relative;
185
+ height: 56px;
186
+ z-index: 5;
187
+ &__container {
188
+ position: absolute;
189
+ bottom: 0;
190
+ width: 100%;
191
+ }
192
+ &__content {
193
+ transition-property: max-height, padding;
194
+ transition-duration: 0.3s;
195
+ transition-timing-function: ease-out;
196
+ }
197
+ }
198
+ .media-editor--preview{
199
+ max-height: calc(100vh - 180px);
200
+ flex-grow: 1;
201
+ @media (max-width: 600px){
202
+ max-height: calc(100vh - 260px);
203
+ min-height: calc(100vh - 260px); }
204
+ }
205
+ .v-dialog .media-editor--preview{
206
+ max-height: calc(100vh - 510px);
207
+ @media (max-width: 600px){
208
+ max-height: calc(100vh - 375px);
209
+ min-height: unset;
210
+ }
211
+ }
212
+ .edit_spacer {
213
+ flex-grow: 0;
214
+ transition: flex-grow 0.3s ease-out;
215
+ }
216
+ .img_overlay {
217
+ position: relative;
218
+ &__button {
219
+ position: absolute;
220
+ z-index: 1;
221
+ color: #333333 !important;
222
+ background: #e0e0e096;
223
+ top: 30px;
224
+ &--back {
225
+ left: 10px;
226
+ }
227
+ &--href {
228
+ right: 10px;
229
+ }
230
+ }
231
+ }
109
232
  </style>
110
233
  <script>
111
234
  import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
235
+ import { mapGetters, mapActions } from "vuex"
112
236
 
113
237
  export default {
114
238
  name: "MediaEditor",
115
239
  data() {
116
240
  return {
117
- media: null
241
+ media: null,
242
+ editing: false,
243
+ newFile: null,
244
+ sameUrl: false,
118
245
  };
119
246
  },
120
- props: {
121
- value: {
122
- type: Object,
123
- default: () => null
124
- }
125
- },
126
247
  computed: {
248
+ ...mapGetters("mapo/media", ["editMedia"]),
127
249
  fileSize() {
128
250
  return this.media && humanFileSize(this.media.size);
129
251
  },
130
252
  dateCreated() {
131
253
  return this.media && new Date(this.media.created).toLocaleString();
132
254
  },
133
- extension() {
134
- return this.media && this.media.file && this.media.file.split(".").pop();
135
- },
136
255
  fileName() {
137
256
  return this.media && this.media.file && this.media.file.split("/").pop();
138
- }
257
+ },
258
+ rotate() {
259
+ return {
260
+ transform: this.editing ? "rotate(180deg)" : "rotate(0deg)",
261
+ transition: "transform .3s cubic-bezier(0.25, 0.8, 0.5, 1)",
262
+ };
263
+ },
264
+ height() {
265
+ switch (this.$vuetify.breakpoint.name) {
266
+ case "xs":
267
+ return "50vh";
268
+ default:
269
+ return 425;
270
+ }
271
+ },
272
+ accept(){
273
+ switch (this.media.mime_type && this.media.mime_type.split("/")[0]) {
274
+ case "image":
275
+ return "image/*"
276
+ case "video":
277
+ return "video/*"
278
+ case "audio":
279
+ return "audio/*"
280
+ default:
281
+ return "*"
282
+ }
283
+ },
284
+ newFilePreview() {
285
+ return this.newFile.type.startsWith("image/") ? URL.createObjectURL(this.newFile) : null;
286
+ },
139
287
  },
140
288
  watch: {
141
- value(val) {
289
+ editMedia(val) {
142
290
  this.media = val;
143
- }
291
+ this.editing = false;
292
+ this.newFile = null;
293
+ this.sameUrl = false;
294
+ },
144
295
  },
145
296
  methods: {
297
+ ...mapActions("mapo/media", ["closeEditor", "deleteMedia", "updateMedia"]),
146
298
  saveMedia() {
147
- this.$emit("updateMedia", this.media);
299
+ this.updateMedia({
300
+ id: this.media.id,
301
+ name: this.media.name,
302
+ title: this.media.title,
303
+ description: this.media.description,
304
+ alt_text: this.media.alt_text,
305
+ file: this.newFile || undefined,
306
+ same_url: (this.newFile && this.sameUrl) || undefined,
307
+ language_code: this.$i18n.locale
308
+ }).then(() => {
309
+ this.newFile = null;
310
+ this.sameUrl = false;
311
+ });
148
312
  },
149
- deleteMedia() {
313
+ confirmDelete() {
150
314
  this.$mapo.$confirm
151
315
  .open({
152
- title: "Delete",
153
- question: "Are you sure you want to delete this media?",
154
- approveButton: { text: "Delete", attrs: { color: "red" } }
316
+ title: this.$t("mapo.delete"),
317
+ question: this.$t("mapo.mediaEditor.confirmDelete"),
318
+ approveButton: { text: this.$t("mapo.delete"), attrs: { color: "red", text: true } },
155
319
  })
156
- .then(res => res && this.$emit("deleteMedia", this.media));
157
- },
158
- close() {
159
- this.$emit("input", null);
320
+ .then((res) => res && this.deleteMedia(this.media));
160
321
  }
161
- }
322
+ },
162
323
  };
163
324
  </script>