@mapomodule/uikit 1.0.0-alpha.12 → 1.0.0-alpha.15
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 +68 -0
- package/components/Detail/Detail.vue +50 -10
- package/components/Detail/DetailField.vue +5 -0
- package/components/Detail/defaults.js +2 -1
- package/components/List/List.vue +18 -2
- package/components/List/ListFilters.vue +39 -8
- package/components/List/ListTable.vue +60 -0
- package/components/MediaManager/MediaManager.vue +7 -6
- package/components/fields/FksField.vue +36 -8
- package/components/fields/MediaField.vue +12 -0
- package/components/fields/Repeater.vue +232 -0
- package/components/fields/wygEditor/defaults.js +3 -3
- package/components/layout/Sidebar/Sidebar.vue +13 -32
- package/components/layout/Sidebar/SidebarFooter.vue +1 -1
- package/components/layout/Sidebar/SidebarListItem.vue +19 -1
- package/components/layout/Sidebar/SidebarProfile.vue +42 -0
- package/components/layout/routebuilder.js +2 -2
- package/layouts/default.vue +20 -7
- package/layouts/empty.vue +10 -0
- package/package.json +5 -4
- package/layouts/error.vue +0 -45
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,74 @@
|
|
|
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.15](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-03-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix detail component for single translatable languages ([cab50e5](https://github.com/lotrekagency/mapo/commit/cab50e5f62ee0a23ae58831b6800d36ca1006377))
|
|
12
|
+
* fix detail-field bad mounting if v-model is too quick ([6198a7d](https://github.com/lotrekagency/mapo/commit/6198a7d695b6b5fee1f86030d8ca0c7fcfe232e4))
|
|
13
|
+
* fix media-field bad mounting if v-model is too quick ([335a7c2](https://github.com/lotrekagency/mapo/commit/335a7c2b5e1b164f1e741fdae3ecd45dc2bb4e0f))
|
|
14
|
+
* removed permanent scrollbar on page body ([2cb3f13](https://github.com/lotrekagency/mapo/commit/2cb3f132f00ee72f14c4327fd595340c9dcdac34))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add sortable capabilities to repeater field ([c962f62](https://github.com/lotrekagency/mapo/commit/c962f626aaf84df4d57ede0b60aca34e4cbd10dd))
|
|
20
|
+
* add sortCallback also to add and remove items in Repeater field ([1ae82c3](https://github.com/lotrekagency/mapo/commit/1ae82c3f63dd7f7ab28e90b308ccdcdf69219226))
|
|
21
|
+
* added Repeater field 🌶 ([f388094](https://github.com/lotrekagency/mapo/commit/f388094ebf93341f8559f13fd73ee1d2172cd73d))
|
|
22
|
+
* **list:** added filtersChange event ([3d2a560](https://github.com/lotrekagency/mapo/commit/3d2a5607e7ecb368314b192af5b58613c57ff9d0))
|
|
23
|
+
* manage backend errors on reordering ([1df55c2](https://github.com/lotrekagency/mapo/commit/1df55c22fe4def3723027a07845d9cd804e6ef3c))
|
|
24
|
+
* **ordering:** added sortablejs to drag and reorder list ([eb8bf21](https://github.com/lotrekagency/mapo/commit/eb8bf21c3178c3ad62db5aa7c06c0562e944dea6))
|
|
25
|
+
* added loading status to fksfield while fetching options ([07137ee](https://github.com/lotrekagency/mapo/commit/07137ee5b0fcc2ee23df7687af0066555cf2a53e))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# [1.0.0-alpha.14](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.13...v1.0.0-alpha.14) (2022-03-01)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* added default choice to filtering ([75d4cb6](https://github.com/lotrekagency/mapo/commit/75d4cb6a4dfde8afc26bffe4b9d88ac3929bbdcd))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# [1.0.0-alpha.13](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-03-01)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* added missing error messages to media field ([1489001](https://github.com/lotrekagency/mapo/commit/148900133c1671acc5a47fe994b41db07013ab2a))
|
|
48
|
+
* clean default layout ([b32e5db](https://github.com/lotrekagency/mapo/commit/b32e5db6876420a3b53bb9da4cf13c7e53fb279f))
|
|
49
|
+
* fix back button in detail page when you came from login or when you have no window history ([7881004](https://github.com/lotrekagency/mapo/commit/78810046d91d02fcfa845bcc7fce95cb011a21ae))
|
|
50
|
+
* fix detail language load ([92a2718](https://github.com/lotrekagency/mapo/commit/92a271878b9f1f2585c3dcc18749adc7c7683ae1))
|
|
51
|
+
* fix error page style ([d8753a1](https://github.com/lotrekagency/mapo/commit/d8753a1ae0a2c857cd4a5417694c17bcf9a5bb9d))
|
|
52
|
+
* fix menu route building for nested folders ([1d15b17](https://github.com/lotrekagency/mapo/commit/1d15b17e3cbb75aa92e301429f667e119ecb9334))
|
|
53
|
+
* fix sidebar menu styling for nested long menus ([ba87f59](https://github.com/lotrekagency/mapo/commit/ba87f5912db02f86c857d237b5408094b63ed164))
|
|
54
|
+
* handle media manager requests errors. ([809704b](https://github.com/lotrekagency/mapo/commit/809704b7822b7991423e108bf1b8e398c19157e9))
|
|
55
|
+
* **detail:** set current lang at mount time ([46c98a7](https://github.com/lotrekagency/mapo/commit/46c98a76a2a787e752b7fea7e2442b719338aa6f))
|
|
56
|
+
* remove logout from sidebar if no user logged in ([e9d562b](https://github.com/lotrekagency/mapo/commit/e9d562b9f6f71a01f8235caa26c24a8f6d5c0f5d))
|
|
57
|
+
* remove remaining toc plugin configuration from tinymce ([9defb47](https://github.com/lotrekagency/mapo/commit/9defb47c5da6e8b7fa87ee39943f9a66d48ca538))
|
|
58
|
+
* remove toc and imagetools plugin from tinymce ([e1d12cf](https://github.com/lotrekagency/mapo/commit/e1d12cf72cf6aa488ed4135788fecd1ffa99da43))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Features
|
|
62
|
+
|
|
63
|
+
* accept axios configuration in endpoint prop of FksField ([9dfca0b](https://github.com/lotrekagency/mapo/commit/9dfca0b5d2a488c0fdab5e8411454e7f0efe5904))
|
|
64
|
+
* added loading page before content retrieve in detail page ([4f26c03](https://github.com/lotrekagency/mapo/commit/4f26c037ab095f931a3ff430b07451de9bef504f))
|
|
65
|
+
* added login button to profile component if no user logged in ([354a25a](https://github.com/lotrekagency/mapo/commit/354a25a32164dc1d284cbe4542c65e04379b1c75))
|
|
66
|
+
* detached SidebarProfile from sidebar component ([92c2894](https://github.com/lotrekagency/mapo/commit/92c28941e6069bbc4e15775ea380c453c7267420))
|
|
67
|
+
* make all modals draggable 🛸 ([57da10d](https://github.com/lotrekagency/mapo/commit/57da10d17aa31d58e55fda5385d45d43beed8c4f))
|
|
68
|
+
* pass errors to slot bindings inDetail component ([9303b39](https://github.com/lotrekagency/mapo/commit/9303b39be40810e526ad5f89428812cd3e7b349d))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
6
74
|
# [1.0.0-alpha.12](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2022-02-16)
|
|
7
75
|
|
|
8
76
|
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
+
<div v-show="loading">
|
|
4
|
+
<v-progress-linear
|
|
5
|
+
color="primary"
|
|
6
|
+
indeterminate
|
|
7
|
+
absolute
|
|
8
|
+
style="top: 0;"
|
|
9
|
+
></v-progress-linear>
|
|
10
|
+
<span class="detail-component-loading ">
|
|
11
|
+
<v-icon size="30">mdi-timer-sand</v-icon>
|
|
12
|
+
Fetching data..
|
|
13
|
+
</span>
|
|
14
|
+
</div>
|
|
15
|
+
<div v-show="!loading">
|
|
3
16
|
<!-- Use this to override the title of the detail component. -->
|
|
4
17
|
<slot name="title" v-bind="slotBindings">
|
|
5
18
|
<!-- `<h1> "Create | Edit" + modelName </h1>` -->
|
|
@@ -16,7 +29,8 @@
|
|
|
16
29
|
<slot name="body.lang" v-bind="slotBindings">
|
|
17
30
|
<!-- [`DetailLangSwitch`](/components/detail/DetailLangSwitch/) -->
|
|
18
31
|
<DetailLangSwitch
|
|
19
|
-
v-if="langs && langs.length
|
|
32
|
+
v-if="langs && langs.length"
|
|
33
|
+
v-show="langs.length > 1"
|
|
20
34
|
class="mb-4"
|
|
21
35
|
v-model="currentLang"
|
|
22
36
|
:langs="langs"
|
|
@@ -93,7 +107,7 @@
|
|
|
93
107
|
<!-- Use this to override the Save button. -->
|
|
94
108
|
<slot name="button.save" v-bind="slotBindings">
|
|
95
109
|
<!-- The Save button. -->
|
|
96
|
-
<v-btn :disabled="isReadonly" class="mb-2" tile block @click="saveItem(true)">{{
|
|
110
|
+
<v-btn v-show="canGoBack" :disabled="isReadonly" class="mb-2" tile block @click="saveItem(true)">{{
|
|
97
111
|
isNew ? "Create" : "Save"
|
|
98
112
|
}}</v-btn>
|
|
99
113
|
</slot>
|
|
@@ -107,7 +121,7 @@
|
|
|
107
121
|
<!-- Use this to override the Back button. -->
|
|
108
122
|
<slot name="button.back" v-bind="slotBindings">
|
|
109
123
|
<!-- The Back button. -->
|
|
110
|
-
<v-btn class="mb-2" tile block @click="
|
|
124
|
+
<v-btn v-show="canGoBack" class="mb-2" tile block @click="back"
|
|
111
125
|
>Back</v-btn
|
|
112
126
|
>
|
|
113
127
|
</slot>
|
|
@@ -186,8 +200,21 @@
|
|
|
186
200
|
</v-row>
|
|
187
201
|
</v-form>
|
|
188
202
|
</div>
|
|
203
|
+
</div>
|
|
189
204
|
</template>
|
|
190
205
|
|
|
206
|
+
<style lang="scss" scoped>
|
|
207
|
+
.detail-component-loading {
|
|
208
|
+
position: absolute;
|
|
209
|
+
top: 50%;
|
|
210
|
+
transform: translateY(-50%);
|
|
211
|
+
width: 100%;
|
|
212
|
+
display: flex;
|
|
213
|
+
flex-direction: column;
|
|
214
|
+
justify-content: center;
|
|
215
|
+
align-items: center;
|
|
216
|
+
}
|
|
217
|
+
</style>
|
|
191
218
|
|
|
192
219
|
<script>
|
|
193
220
|
/**
|
|
@@ -199,7 +226,8 @@ export default {
|
|
|
199
226
|
data() {
|
|
200
227
|
return {
|
|
201
228
|
model: {},
|
|
202
|
-
|
|
229
|
+
modelLanguages: [],
|
|
230
|
+
currentLang: this.lang,
|
|
203
231
|
errors: null
|
|
204
232
|
};
|
|
205
233
|
},
|
|
@@ -254,12 +282,15 @@ export default {
|
|
|
254
282
|
},
|
|
255
283
|
},
|
|
256
284
|
methods: {
|
|
285
|
+
back() {
|
|
286
|
+
this.$nuxt.context?.from?.name == "login" ? this.$router.go(-3) : this.$router.back()
|
|
287
|
+
},
|
|
257
288
|
saveItem(back = false) {
|
|
258
289
|
this.errors = null;
|
|
259
290
|
this.$refs.form?.resetValidation();
|
|
260
291
|
this.crud
|
|
261
292
|
.updateOrCreate(this.model, {}, { multipart: this.multipart })
|
|
262
|
-
.then((resp) => { back ? this
|
|
293
|
+
.then((resp) => { back ? this.back() : this.model = resp })
|
|
263
294
|
.catch(error => {
|
|
264
295
|
this.errors =
|
|
265
296
|
(error.response.status == 400 && error.response.data) || null;
|
|
@@ -280,7 +311,7 @@ export default {
|
|
|
280
311
|
if (res) {
|
|
281
312
|
this.crud
|
|
282
313
|
.delete(this.identifier)
|
|
283
|
-
.then(() => this
|
|
314
|
+
.then(() => this.back())
|
|
284
315
|
.catch(error =>
|
|
285
316
|
this.$mapo.$snack.open({
|
|
286
317
|
message: error.response?.data?.detail || "Something whent bad, please try again later...",
|
|
@@ -349,7 +380,13 @@ export default {
|
|
|
349
380
|
}
|
|
350
381
|
}
|
|
351
382
|
},
|
|
352
|
-
|
|
383
|
+
computed: {
|
|
384
|
+
canGoBack() {
|
|
385
|
+
if (process.browser) {
|
|
386
|
+
return this.$nuxt.context?.from?.name !== "login" && window.history.length > 1 || window.history.length > 3
|
|
387
|
+
}
|
|
388
|
+
return true;
|
|
389
|
+
},
|
|
353
390
|
crud() {
|
|
354
391
|
return this.$mapo.$api.crud(this.endpoint);
|
|
355
392
|
},
|
|
@@ -385,13 +422,12 @@ export default {
|
|
|
385
422
|
return !Object.keys(this.model).length;
|
|
386
423
|
},
|
|
387
424
|
langs() {
|
|
388
|
-
return
|
|
389
|
-
this.model?.lang_info?.site_languages.map(l => l.id) || this.languages
|
|
390
|
-
);
|
|
425
|
+
return this.modelLanguages || this.languages;
|
|
391
426
|
},
|
|
392
427
|
slotBindings() {
|
|
393
428
|
return {
|
|
394
429
|
model: this.model,
|
|
430
|
+
errors: this.errors,
|
|
395
431
|
currentLang: this.currentLang,
|
|
396
432
|
crud: this.crud,
|
|
397
433
|
isNew: this.isNew,
|
|
@@ -415,10 +451,14 @@ export default {
|
|
|
415
451
|
if (this.identifier && this.identifier !== "new") {
|
|
416
452
|
this.crud.detail(this.identifier).then(res => {
|
|
417
453
|
this.model = res;
|
|
454
|
+
this.modelLanguages = this.model?.lang_info?.site_languages.map(l => l.id)
|
|
418
455
|
this.initLang();
|
|
456
|
+
}).catch(error => {
|
|
457
|
+
this.$nuxt.error({ statusCode: error.response.status, message: error.response.data?.detail || "Ops some error occurred.." })
|
|
419
458
|
});
|
|
420
459
|
} else if (this.value) {
|
|
421
460
|
this.model = this.value;
|
|
461
|
+
this.modelLanguages = this.model?.lang_info?.site_languages.map(l => l.id)
|
|
422
462
|
this.initLang();
|
|
423
463
|
}
|
|
424
464
|
}
|
|
@@ -19,6 +19,7 @@ import MediaM2mField from "@mapomodule/uikit/components/fields/MediaM2mField.vue
|
|
|
19
19
|
import MediaField from "@mapomodule/uikit/components/fields/MediaField.vue";
|
|
20
20
|
import SeoPreview from "@mapomodule/uikit/components/fields/SeoPreview.vue";
|
|
21
21
|
import FileField from "@mapomodule/uikit/components/fields/FileField.vue";
|
|
22
|
+
import Repeater from "@mapomodule/uikit/components/fields/Repeater.vue"
|
|
22
23
|
|
|
23
24
|
import { getPointed, setPointed } from "@mapomodule/utils/helpers/objHelpers";
|
|
24
25
|
import defaults from "./defaults";
|
|
@@ -36,6 +37,7 @@ export default {
|
|
|
36
37
|
MediaField,
|
|
37
38
|
SeoPreview,
|
|
38
39
|
FileField,
|
|
40
|
+
Repeater,
|
|
39
41
|
},
|
|
40
42
|
|
|
41
43
|
data() {
|
|
@@ -152,5 +154,8 @@ export default {
|
|
|
152
154
|
);
|
|
153
155
|
},
|
|
154
156
|
},
|
|
157
|
+
mounted(){
|
|
158
|
+
this.setModel()
|
|
159
|
+
}
|
|
155
160
|
};
|
|
156
161
|
</script>
|
package/components/List/List.vue
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/>
|
|
15
15
|
</v-col>
|
|
16
16
|
<v-col cols="12" md="8" class="d-flex flex-nowrap justify-end align-center">
|
|
17
|
-
<ListFilters v-bind="$attrs" v-model="filters">
|
|
17
|
+
<ListFilters v-bind="$attrs" v-model="filters" :disabled="dragOrderingActive">
|
|
18
18
|
<template v-for="(_, slot) in $slots" :slot="slot">
|
|
19
19
|
<!-- @vuese-ignore -->
|
|
20
20
|
<slot :name="slot"></slot>
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
v-model="selection"
|
|
53
53
|
v-bind="{...$attrs, crud, filters}"
|
|
54
54
|
v-on="$listeners"
|
|
55
|
+
@drag-order-change="setDragOrdering"
|
|
55
56
|
ref="dtable"
|
|
56
57
|
>
|
|
57
58
|
<template v-for="(_, slot) in $slots" :slot="slot">
|
|
@@ -82,7 +83,8 @@ export default {
|
|
|
82
83
|
tabActiveStatus: 1,
|
|
83
84
|
selection: [],
|
|
84
85
|
allSelected: false,
|
|
85
|
-
filters: []
|
|
86
|
+
filters: [],
|
|
87
|
+
dragOrderingActive: false
|
|
86
88
|
};
|
|
87
89
|
},
|
|
88
90
|
props: {
|
|
@@ -108,6 +110,14 @@ export default {
|
|
|
108
110
|
// @arg Emit "all" if all items are selected, else the list of the selected rows.
|
|
109
111
|
this.$emit("selectionChange", val);
|
|
110
112
|
},
|
|
113
|
+
filters: {
|
|
114
|
+
deep: true,
|
|
115
|
+
handler(val) {
|
|
116
|
+
// Fires when you change filters options.
|
|
117
|
+
// @arg Emits the same array prop `filters` passed to the component and every filter object inside it contains an `active` array that contains the selected options.
|
|
118
|
+
this.$emit("filtersChange", val);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
111
121
|
},
|
|
112
122
|
methods: {
|
|
113
123
|
refresh() {
|
|
@@ -115,6 +125,12 @@ export default {
|
|
|
115
125
|
},
|
|
116
126
|
toggleSelectAll() {
|
|
117
127
|
return this.$refs?.dtable?.toggleSelectAll();
|
|
128
|
+
},
|
|
129
|
+
setDragOrdering(val){
|
|
130
|
+
this.dragOrderingActive = val;
|
|
131
|
+
if(val){
|
|
132
|
+
this.filters = [];
|
|
133
|
+
}
|
|
118
134
|
}
|
|
119
135
|
},
|
|
120
136
|
mounted() {},
|
|
@@ -158,6 +158,12 @@ export default {
|
|
|
158
158
|
type: Array,
|
|
159
159
|
default: () => [],
|
|
160
160
|
},
|
|
161
|
+
// This is the v-model of the component. It contains the active filters.
|
|
162
|
+
value: {
|
|
163
|
+
// [`Array<Filter>`](#filter-config)
|
|
164
|
+
type: Array,
|
|
165
|
+
default: () => [],
|
|
166
|
+
},
|
|
161
167
|
},
|
|
162
168
|
methods: {
|
|
163
169
|
addDateFilter(filter) {
|
|
@@ -261,15 +267,30 @@ export default {
|
|
|
261
267
|
});
|
|
262
268
|
},
|
|
263
269
|
loadFilters() {
|
|
264
|
-
this.compFilters = this.filters.map(filter => {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
+
this.compFilters = this.filters.map(filter => ({...filter, dates: filter.datepicker ? [] : undefined}));
|
|
271
|
+
this.applyDefaultChoices()
|
|
272
|
+
},
|
|
273
|
+
applyDefaultChoices(){
|
|
274
|
+
this.compFilters.forEach(filter=>{
|
|
275
|
+
if (filter.defaultChoice){
|
|
276
|
+
if (filter.datepicker) {
|
|
277
|
+
filter.dates = [...filter.defaultChoice.split(",")];
|
|
278
|
+
this.addDateFilter(filter);
|
|
279
|
+
} else {
|
|
280
|
+
filter.choices.forEach((c) => {
|
|
281
|
+
filter.defaultChoice.split(",").includes(c.value + "") &&
|
|
282
|
+
this.addFilter(filter, c);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
270
285
|
}
|
|
271
|
-
|
|
272
|
-
|
|
286
|
+
})
|
|
287
|
+
},
|
|
288
|
+
cleanActiveFilters(){
|
|
289
|
+
this.compFilters.forEach(filter => {
|
|
290
|
+
if (!this.activeFilters.find((f) => f.value == filter.value)) {
|
|
291
|
+
this.removeFilter(filter)
|
|
292
|
+
}
|
|
293
|
+
})
|
|
273
294
|
}
|
|
274
295
|
},
|
|
275
296
|
watch: {
|
|
@@ -281,6 +302,15 @@ export default {
|
|
|
281
302
|
this.setQparams(val);
|
|
282
303
|
}, 200),
|
|
283
304
|
},
|
|
305
|
+
value: {
|
|
306
|
+
deep: true,
|
|
307
|
+
handler(val){
|
|
308
|
+
if (JSON.stringify(val) !== JSON.stringify(this.activeFilters)){
|
|
309
|
+
this.activeFilters = val
|
|
310
|
+
this.cleanActiveFilters()
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
284
314
|
},
|
|
285
315
|
created() {
|
|
286
316
|
this.loadFilters();
|
|
@@ -296,6 +326,7 @@ The filters prop is a list of `Filter` objects made of several keys:
|
|
|
296
326
|
|
|
297
327
|
- **"text"** `String` ==> The name of the filter that will be renered inside the filter menu.
|
|
298
328
|
- **"value"** `String` ==> The dotted path of the value we need to filter on.
|
|
329
|
+
- **"defaultChoice"** `String` ==> A choice value that is applied on the startup of the component. This lets you start the list with some filter already applied.
|
|
299
330
|
- **"choices"** `Array<Choice>` ==> The list of choices rendered inside the filter. The text is the label, the value is the string we use as a filter.
|
|
300
331
|
- **"datepicker"** `Boolean` ==> This is a boolean that determines if the filter has a datepicker layout.
|
|
301
332
|
- **"multiple"** `Boolean` ==> This is a boolean that determines if the filter is exclusive or inclusive. In other words, if by selecting a choice it is added to the previous one or if it replaces it.
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
<v-data-table
|
|
4
4
|
v-model="selection"
|
|
5
5
|
v-bind="$attrs"
|
|
6
|
+
:headers="headers"
|
|
7
|
+
:show-select="!dragOrderingActive && $attrs['show-select']"
|
|
6
8
|
:items="serverPaginationEnabled ? items : filteredItems"
|
|
7
9
|
:loading="loading"
|
|
8
10
|
:options.sync="options"
|
|
@@ -10,6 +12,9 @@
|
|
|
10
12
|
:server-items-length="serverItemsLength"
|
|
11
13
|
:class="{ mapo__listtable__all_selected: selectAll }"
|
|
12
14
|
:item-key="lookup"
|
|
15
|
+
:disable-sort="dragOrderingActive"
|
|
16
|
+
v-sortable-data-table
|
|
17
|
+
@sorted="changeOrder"
|
|
13
18
|
>
|
|
14
19
|
<template v-slot:top>
|
|
15
20
|
<v-toolbar flat>
|
|
@@ -43,6 +48,15 @@
|
|
|
43
48
|
</v-toolbar>
|
|
44
49
|
<slot name="dtable.top.under"></slot>
|
|
45
50
|
</template>
|
|
51
|
+
<template v-if="dragReorder" v-slot:footer.prepend>
|
|
52
|
+
<v-tooltip right>
|
|
53
|
+
<template v-slot:activator="{ on, attrs }">
|
|
54
|
+
<v-btn v-bind="attrs" v-on="on" style="margin-left: 2px;" :class="{'primary--text': dragOrderingActive}" @click="dragOrderingActive = !dragOrderingActive" icon>
|
|
55
|
+
<v-icon>mdi-order-bool-ascending</v-icon></v-btn>
|
|
56
|
+
</template>
|
|
57
|
+
<span>Toggle reordering</span>
|
|
58
|
+
</v-tooltip>
|
|
59
|
+
</template>
|
|
46
60
|
<template v-if="navigable" v-slot:[`item.${firstColName}`]="{ item }">
|
|
47
61
|
<NuxtLink :to="detailLink(item)">
|
|
48
62
|
{{ getPointed(item, firstColName, "Unknown") }}
|
|
@@ -60,6 +74,9 @@
|
|
|
60
74
|
</v-icon>
|
|
61
75
|
<v-icon :disabled="!userCan('delete')" small @click="deleteItem(item)"> mdi-delete </v-icon>
|
|
62
76
|
</template>
|
|
77
|
+
<template v-slot:item.drag-column>
|
|
78
|
+
<v-icon class="handle-drag">mdi-drag</v-icon>
|
|
79
|
+
</template>
|
|
63
80
|
<template v-for="slot in nameSpacedSlots($slots, 'dtable.')" :slot="slot">
|
|
64
81
|
<slot :name="`dtable.${slot}`"></slot>
|
|
65
82
|
</template>
|
|
@@ -108,11 +125,13 @@
|
|
|
108
125
|
}
|
|
109
126
|
}
|
|
110
127
|
}
|
|
128
|
+
.handle-drag{ cursor: grab; }
|
|
111
129
|
</style>
|
|
112
130
|
|
|
113
131
|
<script>
|
|
114
132
|
import { getPointed } from "@mapomodule/utils/helpers/objHelpers";
|
|
115
133
|
import { debounce } from "@mapomodule/utils/helpers/debounce";
|
|
134
|
+
import Sortable from "sortablejs"
|
|
116
135
|
|
|
117
136
|
export default {
|
|
118
137
|
name: "ListTable",
|
|
@@ -126,6 +145,7 @@ export default {
|
|
|
126
145
|
searchString: "",
|
|
127
146
|
loadingSearch: false,
|
|
128
147
|
noPagination: false,
|
|
148
|
+
dragOrderingActive: false
|
|
129
149
|
}),
|
|
130
150
|
props: {
|
|
131
151
|
crud: {
|
|
@@ -156,6 +176,24 @@ export default {
|
|
|
156
176
|
type: Array,
|
|
157
177
|
required: false
|
|
158
178
|
},
|
|
179
|
+
dragReorder: {
|
|
180
|
+
type: Boolean,
|
|
181
|
+
default: false,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
directives: {
|
|
185
|
+
sortableDataTable: {
|
|
186
|
+
bind (el, binding, vnode) {
|
|
187
|
+
const options = {
|
|
188
|
+
animation: 150,
|
|
189
|
+
handle: '.handle-drag',
|
|
190
|
+
onUpdate: function (event) {
|
|
191
|
+
vnode.child.$emit('sorted', event)
|
|
192
|
+
},
|
|
193
|
+
}
|
|
194
|
+
Sortable.create(el.getElementsByTagName('tbody')[0], options)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
159
197
|
},
|
|
160
198
|
watch: {
|
|
161
199
|
selection(val) {
|
|
@@ -164,6 +202,13 @@ export default {
|
|
|
164
202
|
selectAll(val) {
|
|
165
203
|
this.$emit("input", val ? "all" : this.selection);
|
|
166
204
|
},
|
|
205
|
+
dragOrderingActive(val) {
|
|
206
|
+
if (val) {
|
|
207
|
+
this.searchString = ""
|
|
208
|
+
this.options = {...this.options, sortBy: []}
|
|
209
|
+
}
|
|
210
|
+
this.$emit("drag-order-change", val)
|
|
211
|
+
},
|
|
167
212
|
filters: {
|
|
168
213
|
deep: true,
|
|
169
214
|
handler() {
|
|
@@ -225,6 +270,17 @@ export default {
|
|
|
225
270
|
}
|
|
226
271
|
});
|
|
227
272
|
}, 500),
|
|
273
|
+
changeOrder(event){
|
|
274
|
+
this.crud.update_order(this.items[event.oldIndex][this.lookup], this.items[event.newIndex][this.lookup]).then(
|
|
275
|
+
res => res.reordered && this.getDataFromApi()
|
|
276
|
+
).catch(error => {
|
|
277
|
+
this.getDataFromApi()
|
|
278
|
+
this.$mapo.$snack.open({
|
|
279
|
+
message: error.response?.data?.detail || "Reorder failed",
|
|
280
|
+
color: "error",
|
|
281
|
+
})
|
|
282
|
+
});
|
|
283
|
+
},
|
|
228
284
|
setQparams(options) {
|
|
229
285
|
this.$router.push({
|
|
230
286
|
query: {
|
|
@@ -377,6 +433,10 @@ export default {
|
|
|
377
433
|
this.$attrs.headers && this.$attrs.headers.length && this.$attrs.headers[0].value
|
|
378
434
|
);
|
|
379
435
|
},
|
|
436
|
+
headers() {
|
|
437
|
+
const dragColumn = { sortable: false, value: 'drag-column', width: '64px' }
|
|
438
|
+
return this.dragOrderingActive ? [ dragColumn,...this.$attrs.headers ] : this.$attrs.headers
|
|
439
|
+
},
|
|
380
440
|
quickModeEnabled() {
|
|
381
441
|
return (
|
|
382
442
|
this.nameSpacedSlots(this.$slots, "qedit.body").length ||
|
|
@@ -160,13 +160,14 @@ export default {
|
|
|
160
160
|
search: this.searchValue || undefined,
|
|
161
161
|
fltr: this.mime ? `mime_type=${this.mime}` : undefined,
|
|
162
162
|
};
|
|
163
|
-
|
|
164
|
-
response =
|
|
165
|
-
params
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
163
|
+
try {
|
|
164
|
+
response = id
|
|
165
|
+
? await this.mediaFolderCrud.detail(id, { params })
|
|
166
|
+
: await this.mediaFolderCrud.list({ params });
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.error({ code: error.response.status, response: error.response.data})
|
|
169
169
|
}
|
|
170
|
+
|
|
170
171
|
this.processResponse(response);
|
|
171
172
|
this.loading = false;
|
|
172
173
|
this.editMedia = null;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-autocomplete
|
|
2
|
+
<v-autocomplete
|
|
3
|
+
v-bind="fieldAttrs"
|
|
4
|
+
v-model="model"
|
|
5
|
+
:items="options"
|
|
6
|
+
></v-autocomplete>
|
|
3
7
|
</template>
|
|
4
8
|
|
|
5
9
|
<script>
|
|
6
10
|
/**
|
|
7
|
-
* This component is made to simplify
|
|
11
|
+
* This component is made to simplify ManyToMany and ForeignKeys associations. With this component you can modify an array selecting items from a list of checkboxes or a signle item selecting from a checkbox.
|
|
8
12
|
*/
|
|
9
13
|
|
|
10
14
|
export default {
|
|
@@ -13,10 +17,11 @@ export default {
|
|
|
13
17
|
return {
|
|
14
18
|
model: null,
|
|
15
19
|
options: [],
|
|
20
|
+
loading: false,
|
|
16
21
|
};
|
|
17
22
|
},
|
|
18
23
|
props: {
|
|
19
|
-
// V-model property. It is the
|
|
24
|
+
// V-model property. It is the attribute to be modified.
|
|
20
25
|
value: {
|
|
21
26
|
type: Object | Array | null,
|
|
22
27
|
required: true,
|
|
@@ -26,16 +31,35 @@ export default {
|
|
|
26
31
|
type: Array,
|
|
27
32
|
default: () => [],
|
|
28
33
|
},
|
|
29
|
-
endpoint
|
|
34
|
+
// This is the endpoint where the component can fetch options.
|
|
35
|
+
endpoint: String | Object,
|
|
30
36
|
},
|
|
31
37
|
computed: {
|
|
32
38
|
fieldAttrs() {
|
|
33
39
|
return {
|
|
34
40
|
chips: this.$attrs.multiple === false ? false : true,
|
|
35
41
|
multiple: true,
|
|
42
|
+
loading: this.loading,
|
|
43
|
+
noDataText: this.loading ? "Fetching data.." : undefined,
|
|
36
44
|
...this.$attrs,
|
|
37
45
|
};
|
|
38
46
|
},
|
|
47
|
+
crudConfig() {
|
|
48
|
+
switch (typeof this.endpoint) {
|
|
49
|
+
case "string":
|
|
50
|
+
return {
|
|
51
|
+
url: this.endpoint,
|
|
52
|
+
conf: null,
|
|
53
|
+
};
|
|
54
|
+
case "object":
|
|
55
|
+
return {
|
|
56
|
+
url: this.endpoint.url,
|
|
57
|
+
conf: this.endpoint.conf,
|
|
58
|
+
};
|
|
59
|
+
default:
|
|
60
|
+
return { url: "", conf: null };
|
|
61
|
+
}
|
|
62
|
+
},
|
|
39
63
|
},
|
|
40
64
|
watch: {
|
|
41
65
|
items(val) {
|
|
@@ -49,11 +73,15 @@ export default {
|
|
|
49
73
|
},
|
|
50
74
|
},
|
|
51
75
|
mounted() {
|
|
52
|
-
if (this.
|
|
76
|
+
if (this.crudConfig.url) {
|
|
77
|
+
this.loading = true;
|
|
53
78
|
this.$mapo.$api
|
|
54
|
-
.crud(this.
|
|
55
|
-
.list()
|
|
56
|
-
.then((res) =>
|
|
79
|
+
.crud(this.crudConfig.url)
|
|
80
|
+
.list(this.crudConfig.conf)
|
|
81
|
+
.then((res) => {
|
|
82
|
+
this.options = res;
|
|
83
|
+
this.loading = false;
|
|
84
|
+
});
|
|
57
85
|
}
|
|
58
86
|
},
|
|
59
87
|
};
|
|
@@ -104,6 +104,11 @@
|
|
|
104
104
|
|
|
105
105
|
</div>
|
|
106
106
|
</v-hover>
|
|
107
|
+
<v-messages
|
|
108
|
+
v-model="errorMessages"
|
|
109
|
+
color="error"
|
|
110
|
+
class="mt-2"
|
|
111
|
+
/>
|
|
107
112
|
</div>
|
|
108
113
|
</template>
|
|
109
114
|
|
|
@@ -128,6 +133,10 @@ export default {
|
|
|
128
133
|
type: String,
|
|
129
134
|
default: () => "",
|
|
130
135
|
},
|
|
136
|
+
errorMessages: {
|
|
137
|
+
type: String | Array,
|
|
138
|
+
default: () => []
|
|
139
|
+
},
|
|
131
140
|
rmAddBtn: {
|
|
132
141
|
type: Boolean,
|
|
133
142
|
default: false,
|
|
@@ -209,5 +218,8 @@ export default {
|
|
|
209
218
|
this.$emit("input", val);
|
|
210
219
|
},
|
|
211
220
|
},
|
|
221
|
+
mounted(){
|
|
222
|
+
this.internalValue = this.val
|
|
223
|
+
}
|
|
212
224
|
};
|
|
213
225
|
</script>
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="container pa-0">
|
|
3
|
+
<span class="repeater-label">{{ label }}:</span>
|
|
4
|
+
<v-divider />
|
|
5
|
+
<draggable
|
|
6
|
+
v-model="items"
|
|
7
|
+
handle=".repeater-handle-sort"
|
|
8
|
+
@change="sortCallback({ ...$event, items, eventType: 'move' })"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
class="repeater-wrapper"
|
|
12
|
+
v-for="(model, index) in items"
|
|
13
|
+
:key="index"
|
|
14
|
+
>
|
|
15
|
+
<div class="d-flex">
|
|
16
|
+
<v-divider vertical />
|
|
17
|
+
<div class="row ma-0">
|
|
18
|
+
<div
|
|
19
|
+
v-for="(field, i) in parsedFields"
|
|
20
|
+
:key="i"
|
|
21
|
+
:class="field.class || 'col-12'"
|
|
22
|
+
>
|
|
23
|
+
<DetailField
|
|
24
|
+
v-model="items[index]"
|
|
25
|
+
:conf="field"
|
|
26
|
+
:errors="getErrors(index)"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="repeater-side-bar grey lighten-2">
|
|
31
|
+
<span
|
|
32
|
+
class="repeater-counter grey--text text--darken-2 text-truncate"
|
|
33
|
+
>{{ index + 1 }}</span
|
|
34
|
+
>
|
|
35
|
+
<v-tooltip right>
|
|
36
|
+
<template v-slot:activator="{ on, attrs }">
|
|
37
|
+
<v-icon
|
|
38
|
+
v-if="sortable"
|
|
39
|
+
v-bind="attrs"
|
|
40
|
+
v-on="on"
|
|
41
|
+
color="grey darken-3"
|
|
42
|
+
class="grey lighten-2 repeater-action repeater-add-line-index"
|
|
43
|
+
@click="addItem(index)"
|
|
44
|
+
>mdi-plus-circle-outline</v-icon
|
|
45
|
+
>
|
|
46
|
+
</template>
|
|
47
|
+
<span>Add here</span>
|
|
48
|
+
</v-tooltip>
|
|
49
|
+
|
|
50
|
+
<v-tooltip right>
|
|
51
|
+
<template v-slot:activator="{ on, attrs }">
|
|
52
|
+
<v-hover v-slot="{ hover }">
|
|
53
|
+
<v-icon
|
|
54
|
+
v-bind="attrs"
|
|
55
|
+
v-on="on"
|
|
56
|
+
:color="hover ? 'error' : 'grey darken-3'"
|
|
57
|
+
class="repeater-action repeater-remove-line"
|
|
58
|
+
@click="removeItem(index)"
|
|
59
|
+
>mdi-minus-circle-outline</v-icon
|
|
60
|
+
>
|
|
61
|
+
</v-hover>
|
|
62
|
+
</template>
|
|
63
|
+
<span>Remove</span>
|
|
64
|
+
</v-tooltip>
|
|
65
|
+
<v-icon
|
|
66
|
+
v-if="sortable"
|
|
67
|
+
color="grey darken-3"
|
|
68
|
+
class="repeater-action repeater-handle-sort"
|
|
69
|
+
>mdi-drag</v-icon
|
|
70
|
+
>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
<v-divider />
|
|
74
|
+
</div>
|
|
75
|
+
</draggable>
|
|
76
|
+
<div class="d-flex justify-end">
|
|
77
|
+
<v-btn class="repeater-add-line" @click="addItem" outlined tile text>
|
|
78
|
+
<v-icon>mdi-plus</v-icon> Add</v-btn
|
|
79
|
+
>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<style lang="scss" scoped>
|
|
85
|
+
.repeater-action {
|
|
86
|
+
display: none;
|
|
87
|
+
}
|
|
88
|
+
.repeater-side-bar {
|
|
89
|
+
min-width: 24px;
|
|
90
|
+
position: relative;
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
align-content: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
&:hover {
|
|
96
|
+
.repeater-action {
|
|
97
|
+
display: inline-flex;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
.repeater-counter {
|
|
101
|
+
position: absolute;
|
|
102
|
+
align-self: center;
|
|
103
|
+
top: 10px;
|
|
104
|
+
}
|
|
105
|
+
.repeater-add-line-index {
|
|
106
|
+
position: absolute;
|
|
107
|
+
align-self: center;
|
|
108
|
+
top: -11px;
|
|
109
|
+
border-radius: 50%;
|
|
110
|
+
}
|
|
111
|
+
.repeater-handle-sort {
|
|
112
|
+
position: absolute;
|
|
113
|
+
align-self: center;
|
|
114
|
+
bottom: 2px;
|
|
115
|
+
cursor: grab;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
.repeater-add-line {
|
|
119
|
+
border-top: none;
|
|
120
|
+
}
|
|
121
|
+
</style>
|
|
122
|
+
|
|
123
|
+
<script>
|
|
124
|
+
import draggable from "vuedraggable";
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* This component is made to manage a list of object that can be added/removed/reordered with a simple form.
|
|
128
|
+
*/
|
|
129
|
+
export default {
|
|
130
|
+
name: "Repeater",
|
|
131
|
+
components: {
|
|
132
|
+
draggable,
|
|
133
|
+
},
|
|
134
|
+
data() {
|
|
135
|
+
return {
|
|
136
|
+
items: null,
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
props: {
|
|
140
|
+
// V-model of the array needed to edit the objects in realtime.
|
|
141
|
+
value: {
|
|
142
|
+
type: Array,
|
|
143
|
+
default: () => [],
|
|
144
|
+
},
|
|
145
|
+
// Puts the input in an error state and passes through custom error messages.
|
|
146
|
+
errorMessages: {
|
|
147
|
+
type: Array,
|
|
148
|
+
default: () => [],
|
|
149
|
+
},
|
|
150
|
+
// Sets input label.
|
|
151
|
+
label: {
|
|
152
|
+
type: String,
|
|
153
|
+
},
|
|
154
|
+
// The main configuration that determines the arrangement of the fields in each line.
|
|
155
|
+
fields: {
|
|
156
|
+
// [`DetailConfiguration`](/components/Detail/Detail/#detailconfiguration)
|
|
157
|
+
type: Array,
|
|
158
|
+
default: () => [],
|
|
159
|
+
},
|
|
160
|
+
// Makes the repeater field sortable.
|
|
161
|
+
sortable: Boolean,
|
|
162
|
+
// This callback is called during sort/add/remove item if the Repeater is sortable. Use this callback to change some prop of the items in the list.
|
|
163
|
+
sortCallback: {
|
|
164
|
+
type: Function,
|
|
165
|
+
default: () => {},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
watch: {
|
|
169
|
+
value(val) {
|
|
170
|
+
this.items = val;
|
|
171
|
+
},
|
|
172
|
+
items(val) {
|
|
173
|
+
this.$emit("input", val);
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
methods: {
|
|
177
|
+
addItem(index) {
|
|
178
|
+
const element = {};
|
|
179
|
+
const newIndex = typeof index == "number" ? index : this.items.length;
|
|
180
|
+
this.items.splice(newIndex, 0, element);
|
|
181
|
+
this.sortable &&
|
|
182
|
+
this.sortCallback({
|
|
183
|
+
moved: { element, newIndex },
|
|
184
|
+
items: this.items,
|
|
185
|
+
eventType: "add",
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
removeItem(index) {
|
|
189
|
+
const element = this.items[index];
|
|
190
|
+
this.items.splice(index, 1);
|
|
191
|
+
this.sortable &&
|
|
192
|
+
this.sortCallback({
|
|
193
|
+
moved: { element, oldIndex: index },
|
|
194
|
+
items: this.items,
|
|
195
|
+
eventType: "remove",
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
getErrors(index) {
|
|
199
|
+
return (this.errorMessages || [])[index] || {};
|
|
200
|
+
},
|
|
201
|
+
parseConf(field, i) {
|
|
202
|
+
const conf = typeof field === "string" ? { value: field } : field;
|
|
203
|
+
conf.value = conf.value || "";
|
|
204
|
+
conf.slotName = `fields.${conf.value || i}`;
|
|
205
|
+
if (this.isReadonly) {
|
|
206
|
+
conf.attrs = { ...conf.attrs, readonly: true };
|
|
207
|
+
}
|
|
208
|
+
return conf;
|
|
209
|
+
},
|
|
210
|
+
mapConf(fields) {
|
|
211
|
+
const icon = "mdi-cube-outline";
|
|
212
|
+
const parseGroup = (group) =>
|
|
213
|
+
typeof group === "string"
|
|
214
|
+
? { name: group, icon }
|
|
215
|
+
: { ...group, icon: group.icon !== undefined ? group.icon : icon };
|
|
216
|
+
return fields.map((f, i) =>
|
|
217
|
+
f.group
|
|
218
|
+
? { group: parseGroup(f.group), fields: this.mapConf(f.fields) }
|
|
219
|
+
: this.parseConf(f, i)
|
|
220
|
+
);
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
computed: {
|
|
224
|
+
parsedFields() {
|
|
225
|
+
return this.mapConf(this.fields);
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
mounted() {
|
|
229
|
+
this.items = this.value;
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
</script>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var useDarkMode = false;
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
plugins: 'mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor
|
|
4
|
+
plugins: 'mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount textpattern noneditable help charmap quickbars emoticons',
|
|
5
5
|
// imagetools_cors_hosts: ['picsum.photos'],
|
|
6
6
|
menubar: 'file edit view insert format tools table help',
|
|
7
|
-
menu: { insert: { title: 'Insert', items: 'link mapomedia media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor
|
|
7
|
+
menu: { insert: { title: 'Insert', items: 'link mapomedia media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor | insertdatetime' } },
|
|
8
8
|
toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview | mapomedia media template link anchor codesample | ltr rtl',
|
|
9
9
|
toolbar_sticky: true,
|
|
10
10
|
image_advtab: true,
|
|
@@ -50,7 +50,7 @@ export default {
|
|
|
50
50
|
quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote mapomedia quicktable',
|
|
51
51
|
noneditable_noneditable_class: 'mceNonEditable',
|
|
52
52
|
toolbar_mode: 'sliding',
|
|
53
|
-
contextmenu: 'link mapomedia
|
|
53
|
+
contextmenu: 'link mapomedia table',
|
|
54
54
|
skin: useDarkMode ? 'oxide-dark' : 'oxide',
|
|
55
55
|
content_css: useDarkMode ? 'dark' : 'default',
|
|
56
56
|
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-navigation-drawer
|
|
3
|
-
v-model="
|
|
3
|
+
v-model="drawer"
|
|
4
4
|
:mini-variant.sync="miniVariant"
|
|
5
5
|
width="300"
|
|
6
6
|
:clipped="this.$store.getters['mapo/app/clipped']"
|
|
@@ -9,20 +9,7 @@
|
|
|
9
9
|
>
|
|
10
10
|
<div class="menu_container">
|
|
11
11
|
<div>
|
|
12
|
-
<
|
|
13
|
-
<v-list-item-avatar v-if="avatar">
|
|
14
|
-
<v-img :src="avatar"></v-img>
|
|
15
|
-
</v-list-item-avatar>
|
|
16
|
-
<v-list-item-icon v-else>
|
|
17
|
-
<v-icon>mdi-account</v-icon>
|
|
18
|
-
</v-list-item-icon>
|
|
19
|
-
<v-list-item-title>{{
|
|
20
|
-
this.$mapo.$auth.user.username
|
|
21
|
-
}}</v-list-item-title>
|
|
22
|
-
<v-btn icon @click.stop="miniVariant = !miniVariant">
|
|
23
|
-
<v-icon>mdi-chevron-left</v-icon>
|
|
24
|
-
</v-btn>
|
|
25
|
-
</v-list-item>
|
|
12
|
+
<SidebarProfile />
|
|
26
13
|
<v-divider></v-divider>
|
|
27
14
|
</div>
|
|
28
15
|
<div class="menu_container">
|
|
@@ -48,13 +35,8 @@
|
|
|
48
35
|
// @vuese
|
|
49
36
|
export default {
|
|
50
37
|
name: "Sidebar",
|
|
51
|
-
data() {
|
|
52
|
-
return {
|
|
53
|
-
miniVariant: false
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
38
|
computed: {
|
|
57
|
-
|
|
39
|
+
drawer: {
|
|
58
40
|
get() {
|
|
59
41
|
return this.$store.getters["mapo/app/drawer"];
|
|
60
42
|
},
|
|
@@ -62,19 +44,18 @@ export default {
|
|
|
62
44
|
if (this.$store.getters["mapo/app/drawer"] !== value)
|
|
63
45
|
this.$store.dispatch("mapo/app/toggleSidebarDrawer");
|
|
64
46
|
return value;
|
|
65
|
-
}
|
|
47
|
+
},
|
|
66
48
|
},
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
miniVariant: {
|
|
50
|
+
get() {
|
|
51
|
+
return this.$store.getters["mapo/app/minivariant"];
|
|
52
|
+
},
|
|
53
|
+
set(value) {
|
|
54
|
+
if (this.$store.getters["mapo/app/minivariant"] !== value)
|
|
55
|
+
this.$store.dispatch("mapo/app/toggleSidebarMinivariant");
|
|
56
|
+
return value;
|
|
57
|
+
},
|
|
69
58
|
},
|
|
70
|
-
avatar() {
|
|
71
|
-
return this.$mapo.$auth.user.avatar;
|
|
72
|
-
}
|
|
73
59
|
},
|
|
74
|
-
methods: {
|
|
75
|
-
drawerReverse() {
|
|
76
|
-
return (this.drawer = !this.drawer);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
60
|
};
|
|
80
61
|
</script>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/>
|
|
15
15
|
</v-list>
|
|
16
16
|
<v-divider></v-divider>
|
|
17
|
-
<v-list-item dense class="logout__button" link @click.native="logout">
|
|
17
|
+
<v-list-item v-if="$mapo.$auth.user.isLoggedIn" dense class="logout__button" link @click.native="logout">
|
|
18
18
|
<v-list-item-icon>
|
|
19
19
|
<v-icon>mdi-logout</v-icon>
|
|
20
20
|
</v-list-item-icon>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
>
|
|
24
24
|
</v-list-item>
|
|
25
25
|
|
|
26
|
-
<div :style="indent" v-if="childrens.length && expanded && !forceCollapse">
|
|
26
|
+
<div class="child-menu" :style="indent" v-if="childrens.length && expanded && !forceCollapse">
|
|
27
27
|
<SidebarListItem
|
|
28
28
|
v-for="(item, i) in childrens"
|
|
29
29
|
:key="i"
|
|
@@ -76,6 +76,19 @@
|
|
|
76
76
|
z-index: -1;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
.child-menu {
|
|
80
|
+
position: relative;
|
|
81
|
+
&::after {
|
|
82
|
+
content: "";
|
|
83
|
+
position: absolute;
|
|
84
|
+
width: 0px;
|
|
85
|
+
height: 100%;
|
|
86
|
+
top: -9px;
|
|
87
|
+
margin-left: -4px;
|
|
88
|
+
border-left: solid 3px #acacac;
|
|
89
|
+
z-index: -1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
79
92
|
}
|
|
80
93
|
.spider-menu.child:last-child {
|
|
81
94
|
.v-list-item__icon {
|
|
@@ -86,6 +99,11 @@
|
|
|
86
99
|
border-bottom-left-radius: 3px;
|
|
87
100
|
}
|
|
88
101
|
}
|
|
102
|
+
.child-menu{
|
|
103
|
+
&::after {
|
|
104
|
+
height: 0px;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
89
107
|
}
|
|
90
108
|
</style>
|
|
91
109
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-list-item>
|
|
3
|
+
<v-list-item-avatar v-if="avatar">
|
|
4
|
+
<v-img :src="avatar"></v-img>
|
|
5
|
+
</v-list-item-avatar>
|
|
6
|
+
<v-list-item-icon v-else>
|
|
7
|
+
<v-icon>mdi-account</v-icon>
|
|
8
|
+
</v-list-item-icon>
|
|
9
|
+
<v-list-item-title>
|
|
10
|
+
<span v-if="isLoggedIn">
|
|
11
|
+
{{ username }}
|
|
12
|
+
</span>
|
|
13
|
+
<NuxtLink v-else to="/login"> Login </NuxtLink>
|
|
14
|
+
</v-list-item-title>
|
|
15
|
+
<v-btn icon @click.stop="toggleMiniVariant">
|
|
16
|
+
<v-icon>mdi-chevron-left</v-icon>
|
|
17
|
+
</v-btn>
|
|
18
|
+
</v-list-item>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
// @vuese
|
|
24
|
+
export default {
|
|
25
|
+
computed: {
|
|
26
|
+
username() {
|
|
27
|
+
return this.isLoggedIn ? this.$mapo.$auth.user.username : "";
|
|
28
|
+
},
|
|
29
|
+
avatar() {
|
|
30
|
+
return this.$mapo.$auth.user.avatar;
|
|
31
|
+
},
|
|
32
|
+
isLoggedIn() {
|
|
33
|
+
return this.$mapo.$auth.user.isLoggedIn;
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
toggleMiniVariant() {
|
|
38
|
+
this.$store.dispatch("mapo/app/toggleSidebarMinivariant");
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
@@ -22,7 +22,7 @@ function buildRoutes(routes, defaultIcon) {
|
|
|
22
22
|
|
|
23
23
|
function nestReduce(array, defaultIcon) {
|
|
24
24
|
return array.reduce((stack, route) => {
|
|
25
|
-
const names = route.relPath.split("/");
|
|
25
|
+
const names = (route.relPath || "").split("/");
|
|
26
26
|
if (names.length === 1) {
|
|
27
27
|
stack.push(route);
|
|
28
28
|
} else {
|
|
@@ -31,7 +31,7 @@ function nestReduce(array, defaultIcon) {
|
|
|
31
31
|
if (pIndex === -1) {
|
|
32
32
|
const label = (route.meta && route.meta.parentLabel) || name
|
|
33
33
|
const icon = (route.meta && route.meta.parentIcon) || getDefaultIcon({ route, label }, defaultIcon)
|
|
34
|
-
stack.push({ name, label, icon, childrens: [] });
|
|
34
|
+
stack.push({ name, label, icon, relPath: name, childrens: [] });
|
|
35
35
|
pIndex = stack.length - 1;
|
|
36
36
|
}
|
|
37
37
|
stack[pIndex].childrens.push(
|
package/layouts/default.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-app>
|
|
3
3
|
<Sidebar />
|
|
4
|
-
<Topbar
|
|
4
|
+
<Topbar />
|
|
5
5
|
<v-main>
|
|
6
6
|
<nuxt />
|
|
7
7
|
<root-components />
|
|
@@ -9,13 +9,26 @@
|
|
|
9
9
|
</v-app>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
|
+
<style lang="scss">
|
|
13
|
+
html { overflow-y: auto }
|
|
14
|
+
.v-main__wrap {
|
|
15
|
+
.__nuxt-error-page {
|
|
16
|
+
background: transparent;
|
|
17
|
+
.error {
|
|
18
|
+
background: transparent !important;
|
|
19
|
+
svg {
|
|
20
|
+
// fill: #ff5252 !important;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
12
26
|
|
|
13
27
|
<script>
|
|
28
|
+
import initDraggable from "@mapomodule/utils/plugins/v-draggable-modals";
|
|
14
29
|
export default {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
}
|
|
30
|
+
mounted() {
|
|
31
|
+
initDraggable();
|
|
32
|
+
},
|
|
20
33
|
};
|
|
21
|
-
</script>
|
|
34
|
+
</script>
|
package/layouts/empty.vue
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/uikit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.15",
|
|
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.
|
|
11
|
-
"@nuxtjs/vuetify": "^1.12.
|
|
10
|
+
"@mapomodule/utils": "^1.0.0-alpha.15",
|
|
11
|
+
"@nuxtjs/vuetify": "^1.12.3",
|
|
12
|
+
"vuedraggable": "^2.24.3"
|
|
12
13
|
},
|
|
13
14
|
"publishConfig": {
|
|
14
15
|
"access": "public"
|
|
15
16
|
},
|
|
16
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "cd42b3dd094ef3bf743c67819e6059bf9ccac491"
|
|
17
18
|
}
|
package/layouts/error.vue
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-app>
|
|
3
|
-
<h1 v-if="error.statusCode === 404">
|
|
4
|
-
{{ pageNotFound }}
|
|
5
|
-
</h1>
|
|
6
|
-
<h1 v-else>
|
|
7
|
-
{{ otherError }}
|
|
8
|
-
</h1>
|
|
9
|
-
<NuxtLink to="/">
|
|
10
|
-
Home page
|
|
11
|
-
</NuxtLink>
|
|
12
|
-
<root-components />
|
|
13
|
-
</v-app>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
export default {
|
|
18
|
-
layout: 'empty',
|
|
19
|
-
props: {
|
|
20
|
-
error: {
|
|
21
|
-
type: Object,
|
|
22
|
-
default: null
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
data () {
|
|
26
|
-
return {
|
|
27
|
-
pageNotFound: '404 Not Found',
|
|
28
|
-
otherError: 'An error occurred'
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
head () {
|
|
32
|
-
const title =
|
|
33
|
-
this.error.statusCode === 404 ? this.pageNotFound : this.otherError
|
|
34
|
-
return {
|
|
35
|
-
title
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<style scoped>
|
|
42
|
-
h1 {
|
|
43
|
-
font-size: 20px;
|
|
44
|
-
}
|
|
45
|
-
</style>
|