@mapomodule/uikit 1.0.0-alpha.13 → 1.0.0-alpha.16
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 +65 -0
- package/components/Detail/Detail.vue +17 -6
- package/components/Detail/DetailField.vue +5 -0
- package/components/Detail/defaults.js +2 -1
- package/components/List/List.vue +21 -3
- package/components/List/ListFilters.vue +39 -8
- package/components/List/ListQuickEdit.vue +6 -1
- package/components/List/ListTable.vue +66 -0
- package/components/MediaManager/MediaFolders.vue +10 -3
- package/components/MediaManager/MediaManager.vue +15 -10
- package/components/MediaManager/MediaManagerDialog.vue +1 -1
- package/components/MediaManager/MediaUploader.vue +1 -1
- package/components/ThemeToggle.vue +13 -0
- package/components/fields/FileField.vue +4 -4
- package/components/fields/FksField.vue +11 -3
- package/components/fields/MediaField.vue +3 -0
- package/components/fields/Repeater.vue +240 -0
- package/components/fields/wygEditor/wygEditor.vue +62 -5
- package/components/layout/Topbar/Topbar.vue +5 -4
- package/layouts/default.vue +1 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,71 @@
|
|
|
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.16](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.15...v1.0.0-alpha.16) (2022-04-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **detail:** fix reference errors in detail component ([f5c3fb2](https://github.com/lotrekagency/mapo/commit/f5c3fb2eefb565ad4a0e58b8d899b86f683caa24))
|
|
12
|
+
* **list:** fix offlineMode data table reordering ([55eb55f](https://github.com/lotrekagency/mapo/commit/55eb55f9fc6b13c7052f946ead68a860cde89e06))
|
|
13
|
+
* **mediamanager:** fix dialog style ([732d748](https://github.com/lotrekagency/mapo/commit/732d74813d81dffc13530aa5a6c8ebf70513a6ef))
|
|
14
|
+
* **mediamanager:** fix media folder style ([0ac29c8](https://github.com/lotrekagency/mapo/commit/0ac29c84efbce03f70ae81cf7fb9d264fac40c4c))
|
|
15
|
+
* prevent filefield bad mount ([cc84540](https://github.com/lotrekagency/mapo/commit/cc84540bd9b93eba95fb8fb92a0862ddeedb0684))
|
|
16
|
+
* **repeater:** fix reordering animation ([fe192fe](https://github.com/lotrekagency/mapo/commit/fe192fe42c44f7f4985d3ba430d5b3dd2d1da692))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* Added mapo integrations module! 🎉 ([76d2c80](https://github.com/lotrekagency/mapo/commit/76d2c805245b4cf49a33696339da52e4c17f4053))
|
|
22
|
+
* **quick-edit:** added possibility to customize dialog props of ListQuickEdit ([f3028c0](https://github.com/lotrekagency/mapo/commit/f3028c0f1d5d5f4a93962158d55bcef3afc46dad))
|
|
23
|
+
* **repeater:** added readonly state to repeater field ([d2aa979](https://github.com/lotrekagency/mapo/commit/d2aa979ffb653e9d53c066fb321b8db679c3b51b))
|
|
24
|
+
* **theme:** added dark/light mode switcher ([1c45cb1](https://github.com/lotrekagency/mapo/commit/1c45cb1dd97f72c4fbf5e607c40e31c1ee615efb))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### BREAKING CHANGES
|
|
28
|
+
|
|
29
|
+
* This change removes all the camomilla cms references moving the compatibility layer in a detached package [mapo-integrations-camomilla](https://github.com/lotrekagency/mapo-integrations-camomilla). The guidelines to make mapo work with camomilla will be provided in the package readme.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# [1.0.0-alpha.15](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-03-11)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* fix detail component for single translatable languages ([cab50e5](https://github.com/lotrekagency/mapo/commit/cab50e5f62ee0a23ae58831b6800d36ca1006377))
|
|
41
|
+
* fix detail-field bad mounting if v-model is too quick ([6198a7d](https://github.com/lotrekagency/mapo/commit/6198a7d695b6b5fee1f86030d8ca0c7fcfe232e4))
|
|
42
|
+
* fix media-field bad mounting if v-model is too quick ([335a7c2](https://github.com/lotrekagency/mapo/commit/335a7c2b5e1b164f1e741fdae3ecd45dc2bb4e0f))
|
|
43
|
+
* removed permanent scrollbar on page body ([2cb3f13](https://github.com/lotrekagency/mapo/commit/2cb3f132f00ee72f14c4327fd595340c9dcdac34))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* add sortable capabilities to repeater field ([c962f62](https://github.com/lotrekagency/mapo/commit/c962f626aaf84df4d57ede0b60aca34e4cbd10dd))
|
|
49
|
+
* add sortCallback also to add and remove items in Repeater field ([1ae82c3](https://github.com/lotrekagency/mapo/commit/1ae82c3f63dd7f7ab28e90b308ccdcdf69219226))
|
|
50
|
+
* added Repeater field 🌶 ([f388094](https://github.com/lotrekagency/mapo/commit/f388094ebf93341f8559f13fd73ee1d2172cd73d))
|
|
51
|
+
* **list:** added filtersChange event ([3d2a560](https://github.com/lotrekagency/mapo/commit/3d2a5607e7ecb368314b192af5b58613c57ff9d0))
|
|
52
|
+
* manage backend errors on reordering ([1df55c2](https://github.com/lotrekagency/mapo/commit/1df55c22fe4def3723027a07845d9cd804e6ef3c))
|
|
53
|
+
* **ordering:** added sortablejs to drag and reorder list ([eb8bf21](https://github.com/lotrekagency/mapo/commit/eb8bf21c3178c3ad62db5aa7c06c0562e944dea6))
|
|
54
|
+
* added loading status to fksfield while fetching options ([07137ee](https://github.com/lotrekagency/mapo/commit/07137ee5b0fcc2ee23df7687af0066555cf2a53e))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# [1.0.0-alpha.14](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.13...v1.0.0-alpha.14) (2022-03-01)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Features
|
|
64
|
+
|
|
65
|
+
* added default choice to filtering ([75d4cb6](https://github.com/lotrekagency/mapo/commit/75d4cb6a4dfde8afc26bffe4b9d88ac3929bbdcd))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
6
71
|
# [1.0.0-alpha.13](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-03-01)
|
|
7
72
|
|
|
8
73
|
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
<slot name="body.lang" v-bind="slotBindings">
|
|
30
30
|
<!-- [`DetailLangSwitch`](/components/detail/DetailLangSwitch/) -->
|
|
31
31
|
<DetailLangSwitch
|
|
32
|
-
v-if="langs && langs.length
|
|
32
|
+
v-if="langs && langs.length"
|
|
33
|
+
v-show="langs.length > 1"
|
|
33
34
|
class="mb-4"
|
|
34
35
|
v-model="currentLang"
|
|
35
36
|
:langs="langs"
|
|
@@ -381,8 +382,8 @@ export default {
|
|
|
381
382
|
},
|
|
382
383
|
computed: {
|
|
383
384
|
canGoBack() {
|
|
384
|
-
if (
|
|
385
|
-
return this.$nuxt
|
|
385
|
+
if (typeof window !== "undefined") {
|
|
386
|
+
return this.$nuxt?.context?.from?.name !== "login" && window.history.length > 1 || window.history.length > 3
|
|
386
387
|
}
|
|
387
388
|
return true;
|
|
388
389
|
},
|
|
@@ -509,11 +510,12 @@ Here the list of the FieldConfiguration type association.
|
|
|
509
510
|
- `textarea` ==> [v-textarea](https://vuetifyjs.com/en/components/textareas/),
|
|
510
511
|
- `switch` ==> [v-switch](https://vuetifyjs.com/en/components/switches/),
|
|
511
512
|
- `slider` ==> [v-slider](https://vuetifyjs.com/en/components/sliders/),
|
|
512
|
-
- `file` ==> [
|
|
513
|
+
- `file` ==> [file-field](/components/fields/FileField/),
|
|
513
514
|
- `editor` ==> [wyg-editor](/components/fields/wygEditor/wygEditor/),
|
|
514
515
|
- `media` ==> [media-field](/components/fields/MediaField/),
|
|
516
|
+
- `mediaList` ==> [media-m2m-field](/components/fields/MediaM2mField/)
|
|
515
517
|
- `m2m` or `fks` ==> [fks-field](/components/fields/FksField/),
|
|
516
|
-
- `
|
|
518
|
+
- `repeater` ==> [repeater](/components/fields/Repeater/),
|
|
517
519
|
|
|
518
520
|
|
|
519
521
|
#### Example of a [`FieldConfiguration`](#fieldconfiguration):
|
|
@@ -550,8 +552,9 @@ This is an interactive example. You can play with it but remember that all http
|
|
|
550
552
|
::: demo
|
|
551
553
|
<template>
|
|
552
554
|
<v-app>
|
|
555
|
+
<div class="d-flex justify-end"><ThemeToggle/></div>
|
|
553
556
|
<Detail
|
|
554
|
-
endpoint="api/
|
|
557
|
+
endpoint="api/articles"
|
|
555
558
|
identifier="new"
|
|
556
559
|
:fields="fields"
|
|
557
560
|
:languages="['it', 'en', 'de']"
|
|
@@ -567,6 +570,14 @@ export default {
|
|
|
567
570
|
main: [
|
|
568
571
|
{ value: "identifier", synci18n: true },
|
|
569
572
|
{ value: "content", type: "editor" },
|
|
573
|
+
{ value: "sections", type: "repeater", attrs: {
|
|
574
|
+
sortable: true,
|
|
575
|
+
fields: [
|
|
576
|
+
{ value: "title", class: "col-md-6" },
|
|
577
|
+
{ value: "subtitle", class: "col-md-6" },
|
|
578
|
+
{ value: "content", type: "textarea" },
|
|
579
|
+
]}
|
|
580
|
+
},
|
|
570
581
|
{
|
|
571
582
|
group: "Seo",
|
|
572
583
|
fields: [
|
|
@@ -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 +174,7 @@ This is an interactive example. You can play with it but remember that all http
|
|
|
158
174
|
::: demo
|
|
159
175
|
<template>
|
|
160
176
|
<v-app>
|
|
177
|
+
<div class="d-flex justify-end"><ThemeToggle/></div>
|
|
161
178
|
<List
|
|
162
179
|
show-select
|
|
163
180
|
title="Sweets archive:"
|
|
@@ -170,11 +187,12 @@ This is an interactive example. You can play with it but remember that all http
|
|
|
170
187
|
searchable
|
|
171
188
|
:data.sync="desserts"
|
|
172
189
|
:actions="[]"
|
|
190
|
+
drag-reorder
|
|
173
191
|
>
|
|
174
192
|
</List>
|
|
175
193
|
<br>
|
|
176
194
|
<h3> Data: </h3>
|
|
177
|
-
<pre>{{ desserts }}</pre>
|
|
195
|
+
<pre style="background-color: unset">{{ desserts }}</pre>
|
|
178
196
|
</v-app>
|
|
179
197
|
</template>
|
|
180
198
|
|
|
@@ -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.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<slot v-bind="{ on, attrs }" name="activator"></slot>
|
|
4
|
-
<v-dialog v-model="dialog"
|
|
4
|
+
<v-dialog v-model="dialog" v-bind="dialogProps">
|
|
5
5
|
<v-card v-bind="$attrs">
|
|
6
6
|
<v-card-title class="pa-0 mb-3">
|
|
7
7
|
<div style="max-width: calc(100% - 40px)">
|
|
@@ -153,6 +153,11 @@ export default {
|
|
|
153
153
|
type: Object,
|
|
154
154
|
required: true,
|
|
155
155
|
},
|
|
156
|
+
dialogProps: {
|
|
157
|
+
type: Object,
|
|
158
|
+
required: false,
|
|
159
|
+
default: { width: 600, scrollable: true }
|
|
160
|
+
},
|
|
156
161
|
offline: Boolean,
|
|
157
162
|
},
|
|
158
163
|
watch: {
|
|
@@ -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,23 @@ export default {
|
|
|
225
270
|
}
|
|
226
271
|
});
|
|
227
272
|
}, 500),
|
|
273
|
+
changeOrder(event){
|
|
274
|
+
if (this.offlineMode) {
|
|
275
|
+
const element = this.items[event.oldIndex]
|
|
276
|
+
this.items.splice(event.oldIndex, 1, )
|
|
277
|
+
this.items.splice(event.newIndex, 0, element);
|
|
278
|
+
} else {
|
|
279
|
+
this.crud.update_order(this.items[event.oldIndex][this.lookup], this.items[event.newIndex][this.lookup]).then(
|
|
280
|
+
res => res.reordered && this.getDataFromApi()
|
|
281
|
+
).catch(error => {
|
|
282
|
+
this.getDataFromApi()
|
|
283
|
+
this.$mapo.$snack.open({
|
|
284
|
+
message: error.response?.data?.detail || "Reorder failed",
|
|
285
|
+
color: "error",
|
|
286
|
+
})
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
},
|
|
228
290
|
setQparams(options) {
|
|
229
291
|
this.$router.push({
|
|
230
292
|
query: {
|
|
@@ -377,6 +439,10 @@ export default {
|
|
|
377
439
|
this.$attrs.headers && this.$attrs.headers.length && this.$attrs.headers[0].value
|
|
378
440
|
);
|
|
379
441
|
},
|
|
442
|
+
headers() {
|
|
443
|
+
const dragColumn = { sortable: false, value: 'drag-column', width: '64px' }
|
|
444
|
+
return this.dragOrderingActive ? [ dragColumn,...this.$attrs.headers ] : this.$attrs.headers
|
|
445
|
+
},
|
|
380
446
|
quickModeEnabled() {
|
|
381
447
|
return (
|
|
382
448
|
this.nameSpacedSlots(this.$slots, "qedit.body").length ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div class="media-folders-wrapper">
|
|
3
3
|
<div v-if="parentFolders && parentFolders.length">
|
|
4
4
|
<span class="mx-2 mt-1 d-flex flex-wrap align-center">
|
|
5
5
|
<span class="mb-1">
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
</span>
|
|
13
13
|
</span>
|
|
14
14
|
</div>
|
|
15
|
-
<v-card-actions class="flex-wrap">
|
|
15
|
+
<v-card-actions class="flex-wrap px-0">
|
|
16
16
|
<div v-if="parentFolder" class="d-none d-sm-block">
|
|
17
17
|
<v-btn
|
|
18
18
|
class="px-2"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
v-for="folder in folders"
|
|
30
30
|
:key="folder.id"
|
|
31
31
|
class="d-flex child-flex"
|
|
32
|
-
:class="{ '
|
|
32
|
+
:class="{ 'px-1': expanded }"
|
|
33
33
|
>
|
|
34
34
|
<div class="folder_grid d-flex flex-column" :class="{ expanded }">
|
|
35
35
|
<v-icon @click.stop="goToFolder(folder)" :size="expanded ? 100 : 40">
|
|
@@ -120,6 +120,13 @@
|
|
|
120
120
|
</div>
|
|
121
121
|
</template>
|
|
122
122
|
<style lang="scss" scoped>
|
|
123
|
+
.media-folders-wrapper{
|
|
124
|
+
width: 100%;
|
|
125
|
+
font-size: 1rem;
|
|
126
|
+
font-weight: 400;
|
|
127
|
+
letter-spacing: 0;
|
|
128
|
+
line-height: 1.4rem;
|
|
129
|
+
}
|
|
123
130
|
.folder_grid {
|
|
124
131
|
.folder_slug {
|
|
125
132
|
width: 65px;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-card elevation="0">
|
|
3
|
-
<v-card-title class="d-flex flex-wrap
|
|
3
|
+
<v-card-title class="d-flex flex-wrap pa-0">
|
|
4
4
|
<div>
|
|
5
5
|
<v-tabs v-model="tab" right background-color="transparent">
|
|
6
6
|
<v-tab>Gallery</v-tab>
|
|
7
7
|
<v-tab>Uploader</v-tab>
|
|
8
8
|
</v-tabs>
|
|
9
9
|
</div>
|
|
10
|
-
<v-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
<v-btn v-show="$vuetify.breakpoint.xs" class="ma-2 ml-auto" @click="getRoot" icon>
|
|
11
|
+
<v-icon>mdi-update</v-icon>
|
|
12
|
+
</v-btn>
|
|
13
|
+
<div class="d-flex ma-auto mr-0" :style="$vuetify.breakpoint.xs ? 'width: 100%' : ''">
|
|
14
|
+
<v-text-field
|
|
15
|
+
v-show="!editMedia && tab == 0"
|
|
13
16
|
v-model="searchValue"
|
|
14
17
|
@input="
|
|
15
18
|
loadingSearch = true;
|
|
@@ -23,14 +26,14 @@
|
|
|
23
26
|
dense
|
|
24
27
|
clearable
|
|
25
28
|
:loading="loadingSearch"
|
|
26
|
-
class="mx-2
|
|
29
|
+
class="mx-2 mt-2"
|
|
27
30
|
></v-text-field>
|
|
28
|
-
<v-btn class="ma-2" @click="getRoot" icon>
|
|
31
|
+
<v-btn v-show="!$vuetify.breakpoint.xs" class="ma-2" @click="getRoot" icon>
|
|
29
32
|
<v-icon>mdi-update</v-icon>
|
|
30
33
|
</v-btn>
|
|
31
|
-
|
|
32
|
-
<v-card-text class="pa-0">
|
|
34
|
+
</div>
|
|
33
35
|
<MediaFolders
|
|
36
|
+
v-show="!editMedia"
|
|
34
37
|
v-if="!noFolders"
|
|
35
38
|
v-bind="{ folders, parentFolders, loading }"
|
|
36
39
|
@updateFolder="updateOrCreateFolder($event)"
|
|
@@ -40,6 +43,8 @@
|
|
|
40
43
|
getRoot();
|
|
41
44
|
"
|
|
42
45
|
/>
|
|
46
|
+
</v-card-title>
|
|
47
|
+
<v-card-text class="pa-0">
|
|
43
48
|
<v-tabs-items v-model="tab" class="transparent">
|
|
44
49
|
<v-tab-item>
|
|
45
50
|
<MediaGallery
|
|
@@ -118,12 +123,12 @@ export default {
|
|
|
118
123
|
computed: {
|
|
119
124
|
mediaFolderCrud() {
|
|
120
125
|
this._mediaFolderCrud =
|
|
121
|
-
this._mediaFolderCrud || this.$mapo.$api.crud("api/
|
|
126
|
+
this._mediaFolderCrud || this.$mapo.$api.crud("api/media-folders");
|
|
122
127
|
return this._mediaFolderCrud;
|
|
123
128
|
},
|
|
124
129
|
mediaFileCrud() {
|
|
125
130
|
this._mediaFileCrud =
|
|
126
|
-
this._mediaFileCrud || this.$mapo.$api.crud("api/
|
|
131
|
+
this._mediaFileCrud || this.$mapo.$api.crud("api/media");
|
|
127
132
|
return this._mediaFileCrud;
|
|
128
133
|
},
|
|
129
134
|
parentFolder: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<slot v-bind="{ on, attrs }" name="activator"></slot>
|
|
4
|
-
<v-dialog v-model="dialog" width="800" scrollable>
|
|
4
|
+
<v-dialog v-model="dialog" max-width="100%" width="800" scrollable>
|
|
5
5
|
<media-manager
|
|
6
6
|
@selectionChange="selectionChange($event)"
|
|
7
7
|
:selection="$attrs.selection"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
<script>
|
|
41
41
|
/**
|
|
42
|
-
* This component is made to
|
|
42
|
+
* This component is made to enhance [v-file-input](https://vuetifyjs.com/en/components/file-inputs/). The main upgrade from the vuetify component is the ability to maintain and show the url of the current saved file.
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
45
|
export default {
|
|
@@ -58,9 +58,6 @@ export default {
|
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
60
|
computed: {
|
|
61
|
-
isString() {
|
|
62
|
-
return typeof this.model == "string";
|
|
63
|
-
},
|
|
64
61
|
model: {
|
|
65
62
|
get() {
|
|
66
63
|
return this.file;
|
|
@@ -104,5 +101,8 @@ export default {
|
|
|
104
101
|
}
|
|
105
102
|
},
|
|
106
103
|
},
|
|
104
|
+
created(){
|
|
105
|
+
this.model = this.value;
|
|
106
|
+
}
|
|
107
107
|
};
|
|
108
108
|
</script>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
<script>
|
|
10
10
|
/**
|
|
11
|
-
* 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.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export default {
|
|
@@ -17,10 +17,11 @@ export default {
|
|
|
17
17
|
return {
|
|
18
18
|
model: null,
|
|
19
19
|
options: [],
|
|
20
|
+
loading: false,
|
|
20
21
|
};
|
|
21
22
|
},
|
|
22
23
|
props: {
|
|
23
|
-
// V-model property. It is the
|
|
24
|
+
// V-model property. It is the attribute to be modified.
|
|
24
25
|
value: {
|
|
25
26
|
type: Object | Array | null,
|
|
26
27
|
required: true,
|
|
@@ -30,6 +31,7 @@ export default {
|
|
|
30
31
|
type: Array,
|
|
31
32
|
default: () => [],
|
|
32
33
|
},
|
|
34
|
+
// This is the endpoint where the component can fetch options.
|
|
33
35
|
endpoint: String | Object,
|
|
34
36
|
},
|
|
35
37
|
computed: {
|
|
@@ -37,6 +39,8 @@ export default {
|
|
|
37
39
|
return {
|
|
38
40
|
chips: this.$attrs.multiple === false ? false : true,
|
|
39
41
|
multiple: true,
|
|
42
|
+
loading: this.loading,
|
|
43
|
+
noDataText: this.loading ? "Fetching data.." : undefined,
|
|
40
44
|
...this.$attrs,
|
|
41
45
|
};
|
|
42
46
|
},
|
|
@@ -70,10 +74,14 @@ export default {
|
|
|
70
74
|
},
|
|
71
75
|
mounted() {
|
|
72
76
|
if (this.crudConfig.url) {
|
|
77
|
+
this.loading = true;
|
|
73
78
|
this.$mapo.$api
|
|
74
79
|
.crud(this.crudConfig.url)
|
|
75
80
|
.list(this.crudConfig.conf)
|
|
76
|
-
.then((res) =>
|
|
81
|
+
.then((res) => {
|
|
82
|
+
this.options = res;
|
|
83
|
+
this.loading = false;
|
|
84
|
+
});
|
|
77
85
|
}
|
|
78
86
|
},
|
|
79
87
|
};
|
|
@@ -0,0 +1,240 @@
|
|
|
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
|
+
animation="150"
|
|
9
|
+
@change="sortCallback({ ...$event, items, eventType: 'move' })"
|
|
10
|
+
>
|
|
11
|
+
<div
|
|
12
|
+
class="repeater-wrapper"
|
|
13
|
+
v-for="(model, index) in items"
|
|
14
|
+
:key="index"
|
|
15
|
+
>
|
|
16
|
+
<div class="d-flex">
|
|
17
|
+
<v-divider vertical />
|
|
18
|
+
<div class="row ma-0">
|
|
19
|
+
<div
|
|
20
|
+
v-for="(field, i) in parsedFields"
|
|
21
|
+
:key="i"
|
|
22
|
+
:class="field.class || 'col-12'"
|
|
23
|
+
>
|
|
24
|
+
<DetailField
|
|
25
|
+
v-model="items[index]"
|
|
26
|
+
:conf="field"
|
|
27
|
+
:errors="getErrors(index)"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="repeater-side-bar grey lighten-2">
|
|
32
|
+
<span
|
|
33
|
+
class="repeater-counter grey--text text--darken-2 text-truncate"
|
|
34
|
+
>{{ index + 1 }}</span
|
|
35
|
+
>
|
|
36
|
+
<v-tooltip right>
|
|
37
|
+
<template v-slot:activator="{ on, attrs }">
|
|
38
|
+
<v-icon
|
|
39
|
+
v-if="!readonly && sortable"
|
|
40
|
+
v-bind="attrs"
|
|
41
|
+
v-on="on"
|
|
42
|
+
color="grey darken-3"
|
|
43
|
+
class="grey lighten-2 repeater-action repeater-add-line-index"
|
|
44
|
+
@click="addItem(index)"
|
|
45
|
+
>mdi-plus-circle-outline</v-icon
|
|
46
|
+
>
|
|
47
|
+
</template>
|
|
48
|
+
<span>Add here</span>
|
|
49
|
+
</v-tooltip>
|
|
50
|
+
<v-tooltip right>
|
|
51
|
+
<template v-slot:activator="{ on, attrs }">
|
|
52
|
+
<v-hover v-slot="{ hover }">
|
|
53
|
+
<v-icon
|
|
54
|
+
v-if="!readonly"
|
|
55
|
+
v-bind="attrs"
|
|
56
|
+
v-on="on"
|
|
57
|
+
:color="hover ? 'error' : 'grey darken-3'"
|
|
58
|
+
class="repeater-action repeater-remove-line"
|
|
59
|
+
@click="removeItem(index)"
|
|
60
|
+
>mdi-minus-circle-outline</v-icon
|
|
61
|
+
>
|
|
62
|
+
</v-hover>
|
|
63
|
+
</template>
|
|
64
|
+
<span>Remove</span>
|
|
65
|
+
</v-tooltip>
|
|
66
|
+
<v-icon
|
|
67
|
+
v-if="!readonly && sortable"
|
|
68
|
+
color="grey darken-3"
|
|
69
|
+
class="repeater-action repeater-handle-sort"
|
|
70
|
+
>mdi-drag</v-icon
|
|
71
|
+
>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
<v-divider />
|
|
75
|
+
</div>
|
|
76
|
+
</draggable>
|
|
77
|
+
<div class="d-flex justify-end">
|
|
78
|
+
<v-btn
|
|
79
|
+
class="repeater-add-line"
|
|
80
|
+
@click="addItem"
|
|
81
|
+
:disabled="readonly"
|
|
82
|
+
outlined
|
|
83
|
+
tile
|
|
84
|
+
text
|
|
85
|
+
>
|
|
86
|
+
<v-icon>mdi-plus</v-icon> Add</v-btn
|
|
87
|
+
>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<style lang="scss" scoped>
|
|
93
|
+
.repeater-action {
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
96
|
+
.repeater-side-bar {
|
|
97
|
+
min-width: 24px;
|
|
98
|
+
position: relative;
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
align-content: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
&:hover {
|
|
104
|
+
.repeater-action {
|
|
105
|
+
display: inline-flex;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
.repeater-counter {
|
|
109
|
+
position: absolute;
|
|
110
|
+
align-self: center;
|
|
111
|
+
top: 10px;
|
|
112
|
+
}
|
|
113
|
+
.repeater-add-line-index {
|
|
114
|
+
position: absolute;
|
|
115
|
+
align-self: center;
|
|
116
|
+
top: -11px;
|
|
117
|
+
border-radius: 50%;
|
|
118
|
+
}
|
|
119
|
+
.repeater-handle-sort {
|
|
120
|
+
position: absolute;
|
|
121
|
+
align-self: center;
|
|
122
|
+
bottom: 2px;
|
|
123
|
+
cursor: grab;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
.repeater-add-line {
|
|
127
|
+
border-top: none;
|
|
128
|
+
}
|
|
129
|
+
</style>
|
|
130
|
+
|
|
131
|
+
<script>
|
|
132
|
+
import draggable from "vuedraggable";
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* This component is made to manage a list of object that can be added/removed/reordered with a simple form.
|
|
136
|
+
*/
|
|
137
|
+
export default {
|
|
138
|
+
name: "Repeater",
|
|
139
|
+
components: {
|
|
140
|
+
draggable,
|
|
141
|
+
},
|
|
142
|
+
data() {
|
|
143
|
+
return {
|
|
144
|
+
items: null,
|
|
145
|
+
};
|
|
146
|
+
},
|
|
147
|
+
props: {
|
|
148
|
+
// V-model of the array needed to edit the objects in realtime.
|
|
149
|
+
value: {
|
|
150
|
+
type: Array,
|
|
151
|
+
default: () => [],
|
|
152
|
+
},
|
|
153
|
+
// The main configuration that determines the arrangement of the fields in each line.
|
|
154
|
+
fields: {
|
|
155
|
+
// [`Array<FieldConfiguration>`](/components/Detail/Detail/#fieldconfiguration)
|
|
156
|
+
type: Array,
|
|
157
|
+
default: () => [],
|
|
158
|
+
},
|
|
159
|
+
// Puts the input in an error state and passes through custom error messages.
|
|
160
|
+
errorMessages: {
|
|
161
|
+
type: Array,
|
|
162
|
+
default: () => [],
|
|
163
|
+
},
|
|
164
|
+
// Sets input label.
|
|
165
|
+
label: String,
|
|
166
|
+
// Makes all the repeater items readonly.
|
|
167
|
+
readonly: Boolean,
|
|
168
|
+
// Makes the repeater field sortable.
|
|
169
|
+
sortable: Boolean,
|
|
170
|
+
// 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.
|
|
171
|
+
sortCallback: {
|
|
172
|
+
type: Function,
|
|
173
|
+
default: () => {},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
watch: {
|
|
177
|
+
value(val) {
|
|
178
|
+
this.items = val;
|
|
179
|
+
},
|
|
180
|
+
items(val) {
|
|
181
|
+
this.$emit("input", val);
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
methods: {
|
|
185
|
+
addItem(index) {
|
|
186
|
+
const element = {};
|
|
187
|
+
const newIndex = typeof index == "number" ? index : this.items.length;
|
|
188
|
+
this.items.splice(newIndex, 0, element);
|
|
189
|
+
this.sortable &&
|
|
190
|
+
this.sortCallback({
|
|
191
|
+
moved: { element, newIndex },
|
|
192
|
+
items: this.items,
|
|
193
|
+
eventType: "add",
|
|
194
|
+
});
|
|
195
|
+
},
|
|
196
|
+
removeItem(index) {
|
|
197
|
+
const element = this.items[index];
|
|
198
|
+
this.items.splice(index, 1);
|
|
199
|
+
this.sortable &&
|
|
200
|
+
this.sortCallback({
|
|
201
|
+
moved: { element, oldIndex: index },
|
|
202
|
+
items: this.items,
|
|
203
|
+
eventType: "remove",
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
getErrors(index) {
|
|
207
|
+
return (this.errorMessages || [])[index] || {};
|
|
208
|
+
},
|
|
209
|
+
parseConf(field, i) {
|
|
210
|
+
const conf = typeof field === "string" ? { value: field } : field;
|
|
211
|
+
conf.value = conf.value || "";
|
|
212
|
+
conf.slotName = `fields.${conf.value || i}`;
|
|
213
|
+
if (this.readonly) {
|
|
214
|
+
conf.attrs = { ...conf.attrs, readonly: true };
|
|
215
|
+
}
|
|
216
|
+
return conf;
|
|
217
|
+
},
|
|
218
|
+
mapConf(fields) {
|
|
219
|
+
const icon = "mdi-cube-outline";
|
|
220
|
+
const parseGroup = (group) =>
|
|
221
|
+
typeof group === "string"
|
|
222
|
+
? { name: group, icon }
|
|
223
|
+
: { ...group, icon: group.icon !== undefined ? group.icon : icon };
|
|
224
|
+
return fields.map((f, i) =>
|
|
225
|
+
f.group
|
|
226
|
+
? { group: parseGroup(f.group), fields: this.mapConf(f.fields) }
|
|
227
|
+
: this.parseConf(f, i)
|
|
228
|
+
);
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
computed: {
|
|
232
|
+
parsedFields() {
|
|
233
|
+
return this.mapConf(this.fields);
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
mounted() {
|
|
237
|
+
this.items = this.value;
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
</script>
|
|
@@ -177,23 +177,80 @@ This is the default [wygEditor configuration](https://www.tiny.cloud/docs/config
|
|
|
177
177
|
|
|
178
178
|
```js
|
|
179
179
|
{
|
|
180
|
-
plugins: 'mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor
|
|
180
|
+
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',
|
|
181
181
|
menubar: 'file edit view insert format tools table help',
|
|
182
|
-
|
|
182
|
+
menu: { insert: { title: 'Insert', items: 'link mapomedia media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor | insertdatetime' } },
|
|
183
|
+
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',
|
|
183
184
|
toolbar_sticky: true,
|
|
184
185
|
image_advtab: true,
|
|
185
186
|
importcss_append: true,
|
|
186
187
|
template_cdate_format: '[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]',
|
|
187
188
|
template_mdate_format: '[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]',
|
|
188
|
-
height:
|
|
189
|
+
height: 400,
|
|
189
190
|
image_caption: true,
|
|
190
|
-
|
|
191
|
+
quickbars_insert_toolbar: 'mapomedia quicktable',
|
|
192
|
+
quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote mapomedia quicktable',
|
|
191
193
|
noneditable_noneditable_class: 'mceNonEditable',
|
|
192
194
|
toolbar_mode: 'sliding',
|
|
193
|
-
contextmenu: 'link
|
|
195
|
+
contextmenu: 'link mapomedia table',
|
|
194
196
|
skin: useDarkMode ? 'oxide-dark' : 'oxide',
|
|
195
197
|
content_css: useDarkMode ? 'dark' : 'default',
|
|
196
198
|
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
|
|
197
199
|
}
|
|
198
200
|
```
|
|
201
|
+
<br><br>
|
|
202
|
+
|
|
203
|
+
## Live Demo
|
|
204
|
+
|
|
205
|
+
<br>
|
|
206
|
+
|
|
207
|
+
::: warning LIVE DEMO 🎉🎉🎉
|
|
208
|
+
This is an interactive example. You can play with it but remember that all http features are disabled since there is no backend server.
|
|
209
|
+
:::
|
|
210
|
+
|
|
211
|
+
::: demo
|
|
212
|
+
<template>
|
|
213
|
+
<v-app>
|
|
214
|
+
<wygEditor v-model="tinyInput" :readonly="readonly" />
|
|
215
|
+
<v-btn dark class="mb-2" @click.native="readonly = !readonly">
|
|
216
|
+
{{ readonly ? "Enable" : "Disable" }} editor
|
|
217
|
+
</v-btn>
|
|
218
|
+
</v-app>
|
|
219
|
+
</template>
|
|
220
|
+
|
|
221
|
+
<script>
|
|
222
|
+
export default {
|
|
223
|
+
data() {
|
|
224
|
+
return {
|
|
225
|
+
readonly: false,
|
|
226
|
+
tinyInput: `
|
|
227
|
+
<p style="text-align: center;"><span style="color: #bdc3c7;">→ This is a full-featured editor demo. Please explore!
|
|
228
|
+
←</span></p>
|
|
229
|
+
<p style="text-align: center;"> </p>
|
|
230
|
+
<h2 style="text-align: center;">TinyMCE is the world's most customizable, and flexible, rich text editor.</h2>
|
|
231
|
+
<p style="text-align: center;"><strong> <span style="font-size: 14pt;"> <span style="color: #7e8c8d; font-weight: 600;">
|
|
232
|
+
A featherweight download, TinyMCE can handle any challenge you throw at it. </span> </span> </strong>
|
|
233
|
+
</p>
|
|
234
|
+
<p style="text-align: center;"> </p>
|
|
235
|
+
<table style="border-collapse: collapse; width: 85%; margin-left: auto; margin-right: auto; border: 0;">
|
|
236
|
+
<tbody>
|
|
237
|
+
<tr>
|
|
238
|
+
<td style="width: 25%; text-align: center; padding: 7px;"><span style="color: #95a5a6;">🛠 50+
|
|
239
|
+
Plugins</span></td>
|
|
240
|
+
<td style="width: 25%; text-align: center; padding: 7px;"><span style="color: #95a5a6;">💡 Premium
|
|
241
|
+
Support</span></td>
|
|
242
|
+
<td style="width: 25%; text-align: center; padding: 7px;"><span style="color: #95a5a6;">🖍 Custom
|
|
243
|
+
Skins</span></td>
|
|
244
|
+
<td style="width: 25%; text-align: center; padding: 7px;"><span style="color: #95a5a6;">⚙ Full API
|
|
245
|
+
Access</span></td>
|
|
246
|
+
</tr>
|
|
247
|
+
</tbody>
|
|
248
|
+
</table>
|
|
249
|
+
`,
|
|
250
|
+
};
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
</script>
|
|
254
|
+
:::
|
|
255
|
+
|
|
199
256
|
</docs>
|
|
@@ -8,20 +8,21 @@
|
|
|
8
8
|
>
|
|
9
9
|
<v-app-bar-nav-icon @click.stop="drawerReverse()" />
|
|
10
10
|
<v-toolbar-title v-text="title" />
|
|
11
|
+
<v-spacer />
|
|
12
|
+
<ThemeToggle/>
|
|
11
13
|
</v-app-bar>
|
|
12
14
|
</template>
|
|
13
15
|
|
|
14
16
|
<script>
|
|
15
|
-
|
|
16
17
|
export default {
|
|
17
18
|
name: "Topbar",
|
|
18
19
|
props: {
|
|
19
|
-
title: String
|
|
20
|
+
title: String,
|
|
20
21
|
},
|
|
21
22
|
methods: {
|
|
22
23
|
drawerReverse() {
|
|
23
24
|
this.$store.dispatch("mapo/app/toggleSidebarDrawer");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
|
+
},
|
|
26
27
|
};
|
|
27
28
|
</script>
|
package/layouts/default.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.16",
|
|
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": "2ef4275464cd8eb28cbbc61c980355b1379186b5"
|
|
17
18
|
}
|