@mapomodule/uikit 1.0.0-alpha.39 → 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.
- package/CHANGELOG.md +31 -0
- package/components/ConfirmDialog.vue +1 -2
- package/components/Detail/Detail.vue +82 -28
- package/components/Detail/DetailLangSwitch.vue +1 -1
- package/components/DropArea.vue +46 -23
- package/components/Form/Form.vue +1 -1
- package/components/Form/FormField.vue +2 -2
- package/components/Form/FormGroup.vue +24 -18
- package/components/Form/FormTabs.vue +11 -7
- package/components/Form/fields/Repeater.vue +5 -6
- package/components/List/ListQuickEdit.vue +1 -1
- package/components/MediaManager/MediaGallery.vue +9 -3
- package/components/MediaManager/MediaUploader.vue +17 -1
- package/components/layout/Sidebar/SidebarList.vue +9 -2
- package/layouts/default.vue +13 -0
- package/package.json +3 -3
- package/translations/en-US.js +3 -1
- package/translations/it-IT.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,37 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-alpha.40](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.39...v1.0.0-alpha.40) (2022-12-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix formfield hideDetails on errors ([4d97992](https://github.com/lotrekagency/mapo/commit/4d9799283b697392c30c0f984958d2bc0332882a))
|
|
12
|
+
* fix repeater mount value ([aacaf20](https://github.com/lotrekagency/mapo/commit/aacaf206693932d103b7c85cf62bb70659b70b7f))
|
|
13
|
+
* fixed detail forceLanguage default ([2ab928a](https://github.com/lotrekagency/mapo/commit/2ab928a6351e65e0d6f4a95db27910d49dee6f63))
|
|
14
|
+
* reduce debounce output with nested repeater to prevent field deletions ([b6a252e](https://github.com/lotrekagency/mapo/commit/b6a252eb411ffad69170393516cf0f983592280a))
|
|
15
|
+
* reset confirm dialog options after transition to prevent graphic glitch ([d2e5138](https://github.com/lotrekagency/mapo/commit/d2e5138901caf8a5c9e5ef59a808d3266ec12868))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add some slots to drop area component ([73d79df](https://github.com/lotrekagency/mapo/commit/73d79df9f43cb88c987b70a44a12180be5bde8d9))
|
|
21
|
+
* added botdy.top and body.bottom slots for forma groups ([3e48d43](https://github.com/lotrekagency/mapo/commit/3e48d43963e3e776c297ed5dbbaa04f930c0b2f5))
|
|
22
|
+
* added draggable capability to media manager selection ([f6311cd](https://github.com/lotrekagency/mapo/commit/f6311cddcb3b97b181eb20dc8585b82bd493df88))
|
|
23
|
+
* added global and single field configuration for initial expanded value in form groups ([69249c1](https://github.com/lotrekagency/mapo/commit/69249c1e7dbee403c262da2814aa2c55678e4b68))
|
|
24
|
+
* added global and single field configuration for initial expanded value in form tabs ([e4f01d0](https://github.com/lotrekagency/mapo/commit/e4f01d0ec73e8c376e6155ae8c2695fc7733ee7c))
|
|
25
|
+
* added route gruard to prevent leaving a detail page with unsaved data ([7d51cd2](https://github.com/lotrekagency/mapo/commit/7d51cd2ec634cb9b32ea88ec87f948265d9c0dfa))
|
|
26
|
+
* added spridermenu option to nuxt.config ([1808d43](https://github.com/lotrekagency/mapo/commit/1808d4365fce57f1979239bf575d241fe66206be))
|
|
27
|
+
* added tab.slug.before and tab.slug.after slots for forms tabs ([42a2497](https://github.com/lotrekagency/mapo/commit/42a249752024d8ffd3e8d784d4cec31145670974))
|
|
28
|
+
* added the possibility to set default langs in nuxt.config ([81b0fe4](https://github.com/lotrekagency/mapo/commit/81b0fe4334b84cdea4527b38a7cc6996f78184da))
|
|
29
|
+
* added usePatch option to partially save data with PATCH http method ([1dfa3b2](https://github.com/lotrekagency/mapo/commit/1dfa3b28cb06e8ded4de7e982a865fa2c06f6f07))
|
|
30
|
+
* added warning on media manager upload for big files ([09743b9](https://github.com/lotrekagency/mapo/commit/09743b981de624234199bfe71e3594a8c4709109))
|
|
31
|
+
* style scrollbars ([48e4c7b](https://github.com/lotrekagency/mapo/commit/48e4c7b047a1062464d823ddeebdc60b96ea11a8))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
6
37
|
# [1.0.0-alpha.39](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.38...v1.0.0-alpha.39) (2022-12-03)
|
|
7
38
|
|
|
8
39
|
|
|
@@ -30,7 +30,6 @@ export default {
|
|
|
30
30
|
return {
|
|
31
31
|
response: null,
|
|
32
32
|
dialog: false,
|
|
33
|
-
optionsBk: null,
|
|
34
33
|
options: {
|
|
35
34
|
title: this.title || this.$t("mapo.confirm"),
|
|
36
35
|
question: this.question || this.$t("mapo.confirmDialog.areYouSure"),
|
|
@@ -142,7 +141,7 @@ export default {
|
|
|
142
141
|
}
|
|
143
142
|
this.dialog = false;
|
|
144
143
|
this.response = false;
|
|
145
|
-
this.options = { ...this.optionsBk };
|
|
144
|
+
setTimeout(() => this.options = { ...this.optionsBk }, 300);
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
};
|
|
@@ -175,6 +175,8 @@
|
|
|
175
175
|
</style>
|
|
176
176
|
|
|
177
177
|
<script>
|
|
178
|
+
import { diffObjs, deepClone } from "@mapomodule/utils/helpers/objHelpers";
|
|
179
|
+
|
|
178
180
|
/**
|
|
179
181
|
* The purpose of this component is to provide you with a very quick way to create an edit page for a payload to send to the server.
|
|
180
182
|
* A use case example could be "build a page that allows you to change the specifications of a product for an ecommerce".<br> <h4>Index:</h4> [[toc]]
|
|
@@ -207,15 +209,19 @@ export default {
|
|
|
207
209
|
type: Object | Array,
|
|
208
210
|
required: true
|
|
209
211
|
},
|
|
212
|
+
usePatch: {
|
|
213
|
+
type: Boolean,
|
|
214
|
+
default() { return this.$mapo.$options?.content?.usePatch || false; },
|
|
215
|
+
},
|
|
210
216
|
// A list of languages into which the payload needs to be translated.
|
|
211
217
|
languages: {
|
|
212
218
|
type: Array,
|
|
213
|
-
default
|
|
219
|
+
default() { return this.$mapo.$options?.content?.languages || []; },
|
|
214
220
|
},
|
|
215
221
|
// Forces use of languages passed as prop, instead of those loaded with model
|
|
216
222
|
forceLanguages: {
|
|
217
223
|
type: Boolean,
|
|
218
|
-
default
|
|
224
|
+
default() { return this.$mapo.$options?.content?.forceLanguages || false; },
|
|
219
225
|
},
|
|
220
226
|
// The url of the endpoint to which the payload is to be sent. From this url a complete crud (See [this.$mapo.$api.crud](/core/#$api.crud)) will be created.
|
|
221
227
|
endpoint: {
|
|
@@ -262,24 +268,19 @@ export default {
|
|
|
262
268
|
this.buttonClicked = back ? "saveAndBackBtn" : "saveBtn";
|
|
263
269
|
this.errors = null;
|
|
264
270
|
this.$refs.form?.resetValidation();
|
|
265
|
-
this.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
(error.response.status == 400 && error.response.data) || null;
|
|
279
|
-
this.$mapo.$snack.open({
|
|
280
|
-
message: error.response?.data?.detail || this.$t("mapo.genericError"),
|
|
281
|
-
color: "error"
|
|
282
|
-
})
|
|
271
|
+
this.apiSendPayload().then((resp) => {
|
|
272
|
+
this.model = resp;
|
|
273
|
+
this.modelBkp = deepClone(this.model);
|
|
274
|
+
this.$mapo.$snack.open({ message: this.isNew ? this.$t("mapo.createSuccess") : this.$t("mapo.saveSuccess"), color: "success" })
|
|
275
|
+
this.isNew && this.$router.replace({ params: { detail: resp.id } })
|
|
276
|
+
back && this.back();
|
|
277
|
+
}).catch(error => {
|
|
278
|
+
this.errors =
|
|
279
|
+
(error.response.status == 400 && error.response.data) || null;
|
|
280
|
+
this.$mapo.$snack.open({
|
|
281
|
+
message: error.response?.data?.detail || this.$t("mapo.genericError"),
|
|
282
|
+
color: "error"
|
|
283
|
+
})
|
|
283
284
|
}).finally(() => {this.buttonClicked = null;});;
|
|
284
285
|
},
|
|
285
286
|
deleteItem() {
|
|
@@ -302,6 +303,34 @@ export default {
|
|
|
302
303
|
}
|
|
303
304
|
});
|
|
304
305
|
},
|
|
306
|
+
setRouterGuard(){
|
|
307
|
+
const checkUnsaved = async (to, from, next) => {
|
|
308
|
+
if (to.name !== from.name && this.hasDiff){
|
|
309
|
+
this.$mapo.$confirm
|
|
310
|
+
.open({
|
|
311
|
+
title: this.$t("mapo.unsavedData"),
|
|
312
|
+
question: this.$t("mapo.confirmLeaveChanges"),
|
|
313
|
+
approveButton: { text: this.$t("mapo.confirm"), attrs: { text: true } }
|
|
314
|
+
}).then(next);
|
|
315
|
+
} else {
|
|
316
|
+
next();
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
checkUnsaved.bind(this);
|
|
320
|
+
this.$router.beforeHooks.push(checkUnsaved);
|
|
321
|
+
window?.addEventListener('beforeunload', this.preventWindowClose);
|
|
322
|
+
},
|
|
323
|
+
preventWindowClose(event){
|
|
324
|
+
const text = this.$t("mapo.confirmLeaveChanges");
|
|
325
|
+
if (this.hasDiff) {
|
|
326
|
+
event.returnValue = text;
|
|
327
|
+
return text;
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
unsetRouterGuard(){
|
|
331
|
+
window?.removeEventListener('beforeunload', this.preventWindowClose);
|
|
332
|
+
this.$router.beforeHooks = this.$router.beforeHooks.filter(({name})=> name != 'checkUnsaved');
|
|
333
|
+
}
|
|
305
334
|
},
|
|
306
335
|
watch: {
|
|
307
336
|
currentLang(val) {
|
|
@@ -323,7 +352,7 @@ export default {
|
|
|
323
352
|
if (val) {
|
|
324
353
|
this.model = val;
|
|
325
354
|
}
|
|
326
|
-
}
|
|
355
|
+
},
|
|
327
356
|
},
|
|
328
357
|
computed: {
|
|
329
358
|
canGoBack() {
|
|
@@ -335,6 +364,20 @@ export default {
|
|
|
335
364
|
crud() {
|
|
336
365
|
return this.$mapo.$api.crud(this.endpoint);
|
|
337
366
|
},
|
|
367
|
+
apiSendPayload(){
|
|
368
|
+
let method, args;
|
|
369
|
+
if (!this.model.id){
|
|
370
|
+
method = this.crud.create;
|
|
371
|
+
args = [this.model, {}, { multipart: this.multipart }]
|
|
372
|
+
} else if (this.usePatch) {
|
|
373
|
+
method = this.crud.partialUpdate;
|
|
374
|
+
args = [this.model.id, this.modelDiff, {}, { multipart: this.multipart }]
|
|
375
|
+
} else {
|
|
376
|
+
method = this.crud.update;
|
|
377
|
+
args = [this.model.id, this.model, {}, { multipart: this.multipart }]
|
|
378
|
+
}
|
|
379
|
+
return async () => method(...args)
|
|
380
|
+
},
|
|
338
381
|
isReadonly() {
|
|
339
382
|
if (this.$mapo.$auth.routeMiddlewares.includes("permissions")) {
|
|
340
383
|
return !this.$mapo.$auth.user.permissions.includes(this.isNew ? "add" : "change");
|
|
@@ -386,22 +429,33 @@ export default {
|
|
|
386
429
|
top: "60px"
|
|
387
430
|
}
|
|
388
431
|
: {};
|
|
432
|
+
},
|
|
433
|
+
modelDiff(){
|
|
434
|
+
return diffObjs(this.modelBkp, this.model) || {};
|
|
435
|
+
},
|
|
436
|
+
hasDiff() {
|
|
437
|
+
return !!(this.modelDiff && Object.keys(this.modelDiff).length > 0);
|
|
389
438
|
}
|
|
390
439
|
},
|
|
391
|
-
mounted() {
|
|
440
|
+
async mounted() {
|
|
392
441
|
if (this.identifier && this.identifier !== "new") {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
442
|
+
try {
|
|
443
|
+
this.model = await this.crud.detail(this.identifier);
|
|
444
|
+
this.modelLanguages = this.model?.lang_info?.site_languages.map(l => l.id);
|
|
445
|
+
} catch (error) {
|
|
446
|
+
this.$nuxt.error({ statusCode: error.response.status, message: error.response.data?.detail || this.$t("mapo.genericError") });
|
|
447
|
+
}
|
|
399
448
|
}
|
|
400
449
|
else if (this.value) {
|
|
401
450
|
this.model = this.value;
|
|
402
451
|
this.modelLanguages = this.model?.lang_info?.site_languages.map(l => l.id);
|
|
403
452
|
}
|
|
453
|
+
this.modelBkp = deepClone(this.model);
|
|
454
|
+
this.setRouterGuard();
|
|
404
455
|
},
|
|
456
|
+
destroyed(){
|
|
457
|
+
this.unsetRouterGuard();
|
|
458
|
+
}
|
|
405
459
|
};
|
|
406
460
|
</script>
|
|
407
461
|
|
|
@@ -31,7 +31,7 @@ export default {
|
|
|
31
31
|
// A list of languages into which the payload needs to be translated.
|
|
32
32
|
langs: {
|
|
33
33
|
type: Array,
|
|
34
|
-
default
|
|
34
|
+
default() { return this.$mapo.$options?.content?.languages || []; }
|
|
35
35
|
},
|
|
36
36
|
// An object representing all the errors of all fields. This component will find errors in each language and will display a little dot in the tab if there are any errors.
|
|
37
37
|
errors: Object,
|
package/components/DropArea.vue
CHANGED
|
@@ -33,29 +33,42 @@
|
|
|
33
33
|
:height="uploadedFiles.length * 64 > 256 ? 256 : uploadedFiles.length * 64"
|
|
34
34
|
item-height="64"
|
|
35
35
|
>
|
|
36
|
-
<template v-slot:default="
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
<template v-slot:default="ctx">
|
|
37
|
+
<slot name="list-item.before" v-bind="{...ctx, editItem, removeItem}"/>
|
|
38
|
+
<slot name="list-item" v-bind="{...ctx, editItem, removeItem}">
|
|
39
|
+
<v-list-item :key="ctx.item.info.name" class="drop-area--item">
|
|
40
|
+
<slot name="list-item.preview.before" v-bind="{...ctx, editItem, removeItem}"/>
|
|
41
|
+
<slot name="list-item.preview" v-bind="{...ctx, editItem, removeItem}">
|
|
42
|
+
<v-list-item-avatar tile v-if="ctx.item.info.objectURL">
|
|
43
|
+
<v-img :src="ctx.item.info.objectURL"></v-img>
|
|
44
|
+
</v-list-item-avatar>
|
|
45
|
+
</slot>
|
|
46
|
+
<slot name="list-item.preview.after" v-bind="{...ctx, editItem, removeItem}"/>
|
|
47
|
+
<slot name="list-item.content.before" v-bind="{...ctx, editItem, removeItem}"/>
|
|
48
|
+
<slot name="list-item.content" v-bind="{...ctx, editItem, removeItem}">
|
|
49
|
+
<v-list-item-content class="cursor-pointer" @click.stop="editItem(ctx.item)">
|
|
50
|
+
<v-list-item-title>
|
|
51
|
+
{{ ctx.item.info.name }}
|
|
52
|
+
</v-list-item-title>
|
|
53
|
+
<v-list-item-subtitle>
|
|
54
|
+
{{ ctx.item.info.type || "type/unknow" }}, {{ ctx.item.info.size }}
|
|
55
|
+
</v-list-item-subtitle>
|
|
56
|
+
</v-list-item-content>
|
|
57
|
+
</slot>
|
|
58
|
+
<slot name="list-item.content.after" v-bind="{...ctx, editItem, removeItem}"/>
|
|
59
|
+
<slot name="list-item.action.before" v-bind="{...ctx, editItem, removeItem}"/>
|
|
60
|
+
<slot name="list-item.action" v-bind="{...ctx, editItem, removeItem}">
|
|
61
|
+
<v-list-item-action>
|
|
62
|
+
<v-btn @click.stop="removeItem(ctx.item.info.name)" icon>
|
|
63
|
+
<v-icon> mdi-close-circle </v-icon>
|
|
64
|
+
</v-btn>
|
|
65
|
+
</v-list-item-action>
|
|
66
|
+
</slot>
|
|
67
|
+
<slot name="list-item.action.after" v-bind="{...ctx, editItem, removeItem}"/>
|
|
41
68
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</v-list-item-title>
|
|
46
|
-
<v-list-item-subtitle>
|
|
47
|
-
{{ item.info.type || "type/unknow" }}, {{ item.info.size }}
|
|
48
|
-
</v-list-item-subtitle>
|
|
49
|
-
</v-list-item-content>
|
|
50
|
-
|
|
51
|
-
<v-list-item-action>
|
|
52
|
-
<v-btn @click.stop="removeFile(item.info.name)" icon>
|
|
53
|
-
<v-icon> mdi-close-circle </v-icon>
|
|
54
|
-
</v-btn>
|
|
55
|
-
</v-list-item-action>
|
|
56
|
-
</v-list-item>
|
|
57
|
-
|
|
58
|
-
<v-divider></v-divider>
|
|
69
|
+
</v-list-item>
|
|
70
|
+
</slot>
|
|
71
|
+
<slot name="list-item.after" v-bind="{...ctx, editItem, removeItem}"/>
|
|
59
72
|
</template>
|
|
60
73
|
</v-virtual-scroll>
|
|
61
74
|
</v-card-text>
|
|
@@ -115,6 +128,15 @@
|
|
|
115
128
|
.cursor-pointer {
|
|
116
129
|
cursor: pointer;
|
|
117
130
|
}
|
|
131
|
+
.v-virtual-scroll__item:not(:last-child){
|
|
132
|
+
.drop-area--item{
|
|
133
|
+
border-bottom: 1px solid;
|
|
134
|
+
border-color: rgba(255, 255, 255, 0.12);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
.theme--light .v-virtual-scroll__item .drop-area--item {
|
|
138
|
+
border-color: rgba(0, 0, 0, 0.12);
|
|
139
|
+
}
|
|
118
140
|
</style>
|
|
119
141
|
|
|
120
142
|
<script>
|
|
@@ -164,7 +186,7 @@ export default {
|
|
|
164
186
|
clearList() {
|
|
165
187
|
this.uploadedFiles = [];
|
|
166
188
|
},
|
|
167
|
-
|
|
189
|
+
removeItem(fileName) {
|
|
168
190
|
const index = this.uploadedFiles.findIndex((file) => file.info.name === fileName);
|
|
169
191
|
if (index > -1) this.uploadedFiles.splice(index, 1);
|
|
170
192
|
},
|
|
@@ -199,6 +221,7 @@ export default {
|
|
|
199
221
|
objectURL: blob.type.startsWith("image/") ? URL.createObjectURL(blob) : null,
|
|
200
222
|
name: blob.name,
|
|
201
223
|
size: humanFileSize(blob.size, true, 2),
|
|
224
|
+
rawsize: blob.size,
|
|
202
225
|
type: blob.type,
|
|
203
226
|
},
|
|
204
227
|
blob,
|
package/components/Form/Form.vue
CHANGED
|
@@ -118,7 +118,7 @@ export default {
|
|
|
118
118
|
// A list of languages into which the payload needs to be translated.
|
|
119
119
|
languages: {
|
|
120
120
|
type: Array,
|
|
121
|
-
default
|
|
121
|
+
default() { return this.$mapo.$options?.content?.languages || []; },
|
|
122
122
|
},
|
|
123
123
|
// Removes debounce from the emitter.
|
|
124
124
|
immediate: Boolean
|
|
@@ -49,7 +49,7 @@ export default {
|
|
|
49
49
|
},
|
|
50
50
|
langs: {
|
|
51
51
|
type: Array,
|
|
52
|
-
default
|
|
52
|
+
default() { return this.$mapo.$options?.content?.languages || []; },
|
|
53
53
|
},
|
|
54
54
|
currentLang: String,
|
|
55
55
|
},
|
|
@@ -177,7 +177,7 @@ export default {
|
|
|
177
177
|
return {
|
|
178
178
|
label: this.label,
|
|
179
179
|
errorMessages: this.errorMessages,
|
|
180
|
-
hideDetails: this.hasErrors,
|
|
180
|
+
hideDetails: !this.hasErrors,
|
|
181
181
|
...this.defaultAttrs,
|
|
182
182
|
readonly: this.readonly,
|
|
183
183
|
...this.conf.attrs,
|
|
@@ -12,22 +12,26 @@
|
|
|
12
12
|
</slot>
|
|
13
13
|
</v-card-title>
|
|
14
14
|
<div v-if="expanded" class="container">
|
|
15
|
-
<
|
|
15
|
+
<slot name="body.top" v-bind="slotBindings" />
|
|
16
|
+
<slot name="body" v-bind="slotBindings">
|
|
17
|
+
<Form
|
|
16
18
|
v-model="model"
|
|
17
19
|
v-bind="{ currentLang, errors, languages, readonly }"
|
|
18
20
|
:fields="conf.fields"
|
|
19
21
|
:moreSlotBindings="slotBindings"
|
|
20
22
|
immediate
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
>
|
|
24
|
+
<template v-for="(_, slot) in $slots" :slot="slot">
|
|
25
|
+
<!-- @vuese-ignore -->
|
|
26
|
+
<slot :name="slot" />
|
|
27
|
+
</template>
|
|
28
|
+
<template v-for="(_, slot) in $scopedSlots" v-slot:[slot]="props">
|
|
29
|
+
<!-- @vuese-ignore -->
|
|
30
|
+
<slot :name="slot" v-bind="props" />
|
|
31
|
+
</template>
|
|
32
|
+
</Form>
|
|
33
|
+
</slot>
|
|
34
|
+
<slot name="body.bottom" v-bind="slotBindings" />
|
|
31
35
|
</div>
|
|
32
36
|
</v-card>
|
|
33
37
|
</template>
|
|
@@ -61,8 +65,13 @@ export default {
|
|
|
61
65
|
name: "FormGroup",
|
|
62
66
|
data() {
|
|
63
67
|
return {
|
|
64
|
-
model:
|
|
65
|
-
expanded:
|
|
68
|
+
model: this.value,
|
|
69
|
+
expanded:
|
|
70
|
+
this.conf?.group?.expanded != undefined
|
|
71
|
+
? this.conf?.group?.expanded
|
|
72
|
+
: this.$mapo.$options?.ui?.forms?.groups?.expanded != undefined
|
|
73
|
+
? this.$mapo.$options?.ui?.forms?.groups?.expanded
|
|
74
|
+
: true,
|
|
66
75
|
};
|
|
67
76
|
},
|
|
68
77
|
props: {
|
|
@@ -88,7 +97,7 @@ export default {
|
|
|
88
97
|
// A list of languages into which the payload needs to be translated.
|
|
89
98
|
languages: {
|
|
90
99
|
type: Array,
|
|
91
|
-
default
|
|
100
|
+
default() { return this.$mapo.$options?.content?.languages || []; },
|
|
92
101
|
},
|
|
93
102
|
// Makes all the fields readonly.
|
|
94
103
|
readonly: Boolean,
|
|
@@ -132,9 +141,6 @@ export default {
|
|
|
132
141
|
}
|
|
133
142
|
return true
|
|
134
143
|
},
|
|
135
|
-
}
|
|
136
|
-
created() {
|
|
137
|
-
this.model = this.value;
|
|
138
|
-
},
|
|
144
|
+
}
|
|
139
145
|
};
|
|
140
146
|
</script>
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
</v-tabs>
|
|
22
22
|
<v-tabs-items v-model="tabIndex">
|
|
23
23
|
<v-tab-item v-for="(tab, index) in conf.tabs" :key="index" class="pt-8">
|
|
24
|
+
<slot :name="`tab.${tab.tab.slug}.before`" v-bind="slotBindings" />
|
|
24
25
|
<slot :name="`tab.${tab.tab.slug}`" v-bind="slotBindings">
|
|
25
26
|
<Form
|
|
26
27
|
v-model="model"
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
</template>
|
|
47
48
|
</Form>
|
|
48
49
|
</slot>
|
|
50
|
+
<slot :name="`tab.${tab.tab.slug}.after`" v-bind="slotBindings" />
|
|
49
51
|
</v-tab-item>
|
|
50
52
|
</v-tabs-items>
|
|
51
53
|
</div>
|
|
@@ -89,9 +91,14 @@ export default {
|
|
|
89
91
|
name: "FormTabs",
|
|
90
92
|
data() {
|
|
91
93
|
return {
|
|
92
|
-
model:
|
|
94
|
+
model: this.value,
|
|
93
95
|
tabIndex: 0,
|
|
94
|
-
expanded:
|
|
96
|
+
expanded:
|
|
97
|
+
this.conf?.group?.expanded != undefined
|
|
98
|
+
? this.conf?.group?.expanded
|
|
99
|
+
: this.$mapo.$options?.ui?.forms?.groups?.expanded != undefined
|
|
100
|
+
? this.$mapo.$options?.ui?.forms?.groups?.expanded
|
|
101
|
+
: true,
|
|
95
102
|
};
|
|
96
103
|
},
|
|
97
104
|
props: {
|
|
@@ -119,7 +126,7 @@ export default {
|
|
|
119
126
|
// A list of languages into which the payload needs to be translated.
|
|
120
127
|
languages: {
|
|
121
128
|
type: Array,
|
|
122
|
-
default
|
|
129
|
+
default() { return this.$mapo.$options?.content?.languages || []; },
|
|
123
130
|
},
|
|
124
131
|
},
|
|
125
132
|
watch: {
|
|
@@ -176,9 +183,6 @@ export default {
|
|
|
176
183
|
}
|
|
177
184
|
return true
|
|
178
185
|
},
|
|
179
|
-
}
|
|
180
|
-
created() {
|
|
181
|
-
this.model = this.value;
|
|
182
|
-
},
|
|
186
|
+
}
|
|
183
187
|
};
|
|
184
188
|
</script>
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
:fields="getFields(model)"
|
|
40
40
|
:errors="getErrors(index)"
|
|
41
41
|
:readonly="readonly"
|
|
42
|
+
immediate
|
|
42
43
|
>
|
|
43
44
|
<template
|
|
44
45
|
v-for="(slot, name) in templateSlots(model, $slots)"
|
|
@@ -264,7 +265,7 @@ export default {
|
|
|
264
265
|
},
|
|
265
266
|
data() {
|
|
266
267
|
return {
|
|
267
|
-
items:
|
|
268
|
+
items: this.value ? deepClone(this.value) : [],
|
|
268
269
|
tModalOpen: false,
|
|
269
270
|
tModalCallback: () => {},
|
|
270
271
|
collapsedStack: (this.value || []).map(() => !!this.collapsable),
|
|
@@ -311,7 +312,7 @@ export default {
|
|
|
311
312
|
langs: {
|
|
312
313
|
// `Array<String>`
|
|
313
314
|
type: Array,
|
|
314
|
-
default
|
|
315
|
+
default() { return this.$mapo.$options?.content?.languages || []; },
|
|
315
316
|
},
|
|
316
317
|
// This is mainly an internal property. It is used by DetailField to pass the active language inherited from the Detail component.
|
|
317
318
|
currentLang: String,
|
|
@@ -319,7 +320,8 @@ export default {
|
|
|
319
320
|
},
|
|
320
321
|
watch: {
|
|
321
322
|
value(val) {
|
|
322
|
-
|
|
323
|
+
const isEmpty = (v) => !v || Object.keys(v).length == 0;
|
|
324
|
+
if (isEmpty(val) && isEmpty(this.items) || JSON.stringify(val) === JSON.stringify(this.items)) return;
|
|
323
325
|
this.items = (val && deepClone(val)) || [];
|
|
324
326
|
if (val.length != this.collapsedStack.length)
|
|
325
327
|
this.collapsedStack = (val || []).map(() => !!this.collapsable);
|
|
@@ -452,9 +454,6 @@ export default {
|
|
|
452
454
|
}
|
|
453
455
|
},
|
|
454
456
|
},
|
|
455
|
-
mounted() {
|
|
456
|
-
this.items = (this.value && deepClone(this.value)) || [];
|
|
457
|
-
},
|
|
458
457
|
};
|
|
459
458
|
</script>
|
|
460
459
|
|
|
@@ -105,7 +105,7 @@ export default {
|
|
|
105
105
|
// A list of languages into which the payload needs to be translated.
|
|
106
106
|
languages: {
|
|
107
107
|
type: Array,
|
|
108
|
-
default
|
|
108
|
+
default() { return this.$mapo.$options?.content?.languages || []; },
|
|
109
109
|
},
|
|
110
110
|
lookup: {
|
|
111
111
|
type: String,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="media-gallery--wrapper">
|
|
3
|
-
<
|
|
3
|
+
<draggable v-model="draggableSelection" animation="150" v-if="selection && selection.length && selectMode == 'multi'" class="media-gallery--selection grey darken-2">
|
|
4
4
|
<MediaPreview
|
|
5
5
|
v-for="media in selection"
|
|
6
6
|
:key="media.file"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
icon-size="20px"
|
|
10
10
|
class="elevation-4 media-gallery--selection-item"
|
|
11
11
|
/>
|
|
12
|
-
</
|
|
12
|
+
</draggable>
|
|
13
13
|
<div ref="masonry" class="media-gallery--masonry" v-if="medias.length">
|
|
14
14
|
<div
|
|
15
15
|
v-for="media in medias"
|
|
@@ -165,11 +165,17 @@ $wcol: calc(100% / 6 - 12px);
|
|
|
165
165
|
|
|
166
166
|
<script>
|
|
167
167
|
import { mapGetters, mapActions } from "vuex"
|
|
168
|
+
import draggable from "vuedraggable";
|
|
168
169
|
|
|
169
170
|
export default {
|
|
170
171
|
name: "MediaGallery",
|
|
172
|
+
components: { draggable },
|
|
171
173
|
computed: {
|
|
172
174
|
...mapGetters("mapo/media", ["page", "pages", "medias", "selection", "selectMode", "loading"]),
|
|
175
|
+
draggableSelection: {
|
|
176
|
+
get() { return this.selection; },
|
|
177
|
+
set(val) { this.setSelection(val); }
|
|
178
|
+
},
|
|
173
179
|
currentPage: {
|
|
174
180
|
get() {
|
|
175
181
|
return this.page;
|
|
@@ -182,7 +188,7 @@ export default {
|
|
|
182
188
|
},
|
|
183
189
|
},
|
|
184
190
|
methods: {
|
|
185
|
-
...mapActions("mapo/media", ["getRoot", "openEditor", "select"]),
|
|
191
|
+
...mapActions("mapo/media", ["getRoot", "openEditor", "select", "setSelection"]),
|
|
186
192
|
isSelected(media) {
|
|
187
193
|
switch (this.selectMode) {
|
|
188
194
|
case "multi":
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
</v-btn>
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
|
+
<template v-slot:list-item.content.after="{ item }">
|
|
15
|
+
<v-chip dense v-if="isTooLarge(item)" color="error">{{$t("mapo.mediaUploader.tooLarge")}}</v-chip>
|
|
16
|
+
</template>
|
|
14
17
|
<template v-slot:editContent="{ editedItem }">
|
|
15
18
|
<v-container>
|
|
16
19
|
<v-row>
|
|
@@ -57,7 +60,9 @@
|
|
|
57
60
|
</template>
|
|
58
61
|
|
|
59
62
|
<script>
|
|
60
|
-
import { mapGetters
|
|
63
|
+
import { mapGetters } from "vuex"
|
|
64
|
+
const MAX_IMAGE_SIZE = 1000000 // 1mb
|
|
65
|
+
const MAX_VIDEO_SIZE = 100000000 // 100mb
|
|
61
66
|
|
|
62
67
|
export default {
|
|
63
68
|
name: "MediaUploader",
|
|
@@ -94,6 +99,17 @@ export default {
|
|
|
94
99
|
}
|
|
95
100
|
},
|
|
96
101
|
methods: {
|
|
102
|
+
isTooLarge({ info }){
|
|
103
|
+
const {type} = info;
|
|
104
|
+
switch (type.split("/")[0]) {
|
|
105
|
+
case "image":
|
|
106
|
+
return info.rawsize > MAX_IMAGE_SIZE;
|
|
107
|
+
case "video":
|
|
108
|
+
return info.rawsize > MAX_VIDEO_SIZE;
|
|
109
|
+
default:
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
},
|
|
97
113
|
updateMediaList(mediaList) {
|
|
98
114
|
this.mediaList = mediaList;
|
|
99
115
|
this.mediaList.forEach(media => {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
:childrens="item.childrens"
|
|
10
10
|
:icon="item.icon"
|
|
11
11
|
:force-collapse="forceCollapse"
|
|
12
|
-
spider-menu
|
|
12
|
+
:spider-menu="spiderMenu"
|
|
13
13
|
/>
|
|
14
14
|
</v-list>
|
|
15
15
|
</template>
|
|
@@ -22,7 +22,14 @@ export default {
|
|
|
22
22
|
name: "SidebarList",
|
|
23
23
|
props: {
|
|
24
24
|
footer: Boolean,
|
|
25
|
-
forceCollapse: Boolean
|
|
25
|
+
forceCollapse: Boolean,
|
|
26
|
+
spiderMenu: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default() {
|
|
29
|
+
const { spiderMenu } = this.$mapo.$options?.ui?.sidebar || {};
|
|
30
|
+
return spiderMenu == undefined ? true : spiderMenu;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
26
33
|
},
|
|
27
34
|
data() {
|
|
28
35
|
return {
|
package/layouts/default.vue
CHANGED
|
@@ -22,13 +22,26 @@ html { overflow-y: auto }
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
::-webkit-scrollbar {
|
|
26
|
+
width: 5px;
|
|
27
|
+
height: 5px;
|
|
28
|
+
}
|
|
29
|
+
::-webkit-scrollbar-track {
|
|
30
|
+
background-color: var(--v-scrollbar-track-color);
|
|
31
|
+
}
|
|
32
|
+
::-webkit-scrollbar-thumb {
|
|
33
|
+
background-color: var(--v-primary-base);
|
|
34
|
+
}
|
|
25
35
|
</style>
|
|
26
36
|
|
|
27
37
|
<script>
|
|
28
38
|
import initDraggable from "@mapomodule/utils/plugins/v-draggable-modals";
|
|
39
|
+
import { setScrollbarTrackColor } from "@mapomodule/utils/helpers/cssVariables"
|
|
29
40
|
export default {
|
|
30
41
|
mounted() {
|
|
31
42
|
initDraggable();
|
|
43
|
+
setScrollbarTrackColor(this.$vuetify.theme.dark)
|
|
32
44
|
},
|
|
45
|
+
watch: { "$vuetify.theme.dark": setScrollbarTrackColor }
|
|
33
46
|
};
|
|
34
47
|
</script>
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/uikit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.40",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "This is part of Mapo nuxt module. Injects Mapo ui components in the nuxt component discovery system.",
|
|
6
6
|
"author": "bnznamco <gabriele.baldi.01@gmail.com>",
|
|
7
7
|
"repository": "https://github.com/lotrekagency/mapo",
|
|
8
8
|
"main": "./module.js",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@mapomodule/utils": "^1.0.0-alpha.
|
|
10
|
+
"@mapomodule/utils": "^1.0.0-alpha.40",
|
|
11
11
|
"@nuxtjs/i18n": "^7.2.2",
|
|
12
12
|
"@nuxtjs/vuetify": "^1.12.3",
|
|
13
13
|
"vuedraggable": "^2.24.3"
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "918d8d3ed9a6edc9be25e082f9917866e8c73c57"
|
|
19
19
|
}
|
package/translations/en-US.js
CHANGED
|
@@ -23,6 +23,8 @@ export default {
|
|
|
23
23
|
saveSuccess: "Item saved succesfully!",
|
|
24
24
|
createSuccess: "Item succesfully created!",
|
|
25
25
|
confirmDelete: "Are you sure you want to delete this item?",
|
|
26
|
+
unsavedData: "Exit page?",
|
|
27
|
+
confirmLeaveChanges: "Changes you made may not be saved.",
|
|
26
28
|
fetchingData: "Fetching data...",
|
|
27
29
|
login: "Login",
|
|
28
30
|
loginError: "Cannot login right now. Try again later.",
|
|
@@ -127,6 +129,6 @@ export default {
|
|
|
127
129
|
fileInfo: "File info succesfully updated",
|
|
128
130
|
},
|
|
129
131
|
// MediaManager/MediaUploader.vue
|
|
130
|
-
mediaUploader: { success: "{numberFiles} files succesfully uploaded" },
|
|
132
|
+
mediaUploader: { success: "{numberFiles} files succesfully uploaded", tooLarge: "Warning! Optimize before upload!" },
|
|
131
133
|
},
|
|
132
134
|
};
|
package/translations/it-IT.js
CHANGED
|
@@ -23,6 +23,8 @@ export default {
|
|
|
23
23
|
saveSuccess: "Elemento salvato con successo!",
|
|
24
24
|
createSuccess: "Elemento creato con successo!",
|
|
25
25
|
confirmDelete: "Vuoi veramente eliminare questo elemento?",
|
|
26
|
+
unsavedData: "Uscire dalla pagina?",
|
|
27
|
+
confirmLeaveChanges: "I dati non sono ancora stati salvati.",
|
|
26
28
|
fetchingData: "Caricamento in corso...",
|
|
27
29
|
login: "Login",
|
|
28
30
|
loginError:
|
|
@@ -129,6 +131,6 @@ export default {
|
|
|
129
131
|
fileInfo: "File info succesfully updated",
|
|
130
132
|
},
|
|
131
133
|
// MediaManager/MediaUploader.vue
|
|
132
|
-
mediaUploader: { success: "{numberFiles} file caricati" },
|
|
134
|
+
mediaUploader: { success: "{numberFiles} file caricati", tooLarge: "Attenzione! Ottimizza prima di caricare!" },
|
|
133
135
|
},
|
|
134
136
|
};
|