@mapomodule/uikit 1.0.0-alpha.7 → 1.0.0-alpha.8
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 +44 -0
- package/components/Detail/Detail.vue +28 -12
- package/components/Detail/DetailField.vue +7 -6
- package/components/Detail/DetailLangSwitch.vue +1 -1
- package/components/Detail/defaults.js +28 -27
- package/components/DropArea.vue +2 -2
- package/components/List/ListActions.vue +18 -0
- package/components/List/ListHead.vue +9 -1
- package/components/List/ListQuickEdit.vue +192 -58
- package/components/List/ListTable.vue +11 -5
- package/components/Login.vue +14 -5
- package/components/MediaManager/MediaEditor.vue +8 -2
- package/components/MediaManager/MediaFolders.vue +3 -3
- package/components/MediaManager/MediaManager.vue +1 -1
- package/components/SnackBar.vue +3 -4
- package/components/fields/DateField.vue +8 -3
- package/components/fields/FksField.vue +60 -0
- package/components/fields/MediaField.vue +13 -5
- package/components/fields/MediaM2mField.vue +8 -3
- package/components/fields/{TinyMce → wygEditor}/defaults.js +0 -0
- package/components/fields/{TinyMce → wygEditor}/utils/events.js +0 -0
- package/components/fields/{TinyMce → wygEditor}/utils/mapomedia.plugin.js +0 -0
- package/components/fields/{TinyMce → wygEditor}/utils/script.injector.js +0 -0
- package/components/fields/{TinyMce/TinyMce.vue → wygEditor/wygEditor.vue} +11 -11
- package/components/layout/Sidebar/SidebarFooter.vue +1 -0
- package/components/layout/Sidebar/SidebarList.vue +1 -0
- package/components/layout/Sidebar/SidebarListItem.vue +17 -1
- package/package.json +3 -3
- package/components/fields/M2mField.vue +0 -95
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
|
|
63
63
|
<v-card-actions class="paginator mt-auto" v-if="pages">
|
|
64
64
|
<v-row justify="center" class="py-2">
|
|
65
|
-
<v-btn text @click="prev">
|
|
65
|
+
<v-btn :disabled="readonly" text @click="prev">
|
|
66
66
|
<v-icon>mdi-chevron-left</v-icon>
|
|
67
67
|
</v-btn>
|
|
68
68
|
<v-item-group v-model="page" class="text-center mx-1" mandatory>
|
|
@@ -71,12 +71,12 @@
|
|
|
71
71
|
:key="`btn-${n}`"
|
|
72
72
|
v-slot="{ active, toggle }"
|
|
73
73
|
>
|
|
74
|
-
<v-btn :input-value="active" icon @click="toggle">
|
|
74
|
+
<v-btn :disabled="readonly" :input-value="active" icon @click="toggle">
|
|
75
75
|
<v-icon>mdi-record</v-icon>
|
|
76
76
|
</v-btn>
|
|
77
77
|
</v-item>
|
|
78
78
|
</v-item-group>
|
|
79
|
-
<v-btn text @click="next">
|
|
79
|
+
<v-btn :disabled="readonly" text @click="next">
|
|
80
80
|
<v-icon>mdi-chevron-right</v-icon>
|
|
81
81
|
</v-btn>
|
|
82
82
|
</v-row>
|
|
@@ -173,6 +173,11 @@ export default {
|
|
|
173
173
|
type: Boolean,
|
|
174
174
|
default: false,
|
|
175
175
|
},
|
|
176
|
+
// This set the component status to readonly, stopping the user interaction.
|
|
177
|
+
readonly: {
|
|
178
|
+
type: Boolean,
|
|
179
|
+
default: false,
|
|
180
|
+
},
|
|
176
181
|
},
|
|
177
182
|
|
|
178
183
|
model: {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -20,18 +20,18 @@ import defaults from "./defaults.js";
|
|
|
20
20
|
import validEvents from "./utils/events.js";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* This component wraps a [
|
|
23
|
+
* This component wraps a [wygEditor](https://www.tiny.cloud/) instance. With the use of the v-model you can use this component to edit any content you like.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
export default {
|
|
27
|
-
name: "
|
|
27
|
+
name: "wygEditor",
|
|
28
28
|
props: {
|
|
29
|
-
// V-model property. Is the content that will populate the
|
|
29
|
+
// V-model property. Is the content that will populate the wygEditor instance.
|
|
30
30
|
value: {
|
|
31
31
|
type: String,
|
|
32
32
|
default: "",
|
|
33
33
|
},
|
|
34
|
-
// This is the main configuration of
|
|
34
|
+
// This is the main configuration of wygEditor. If setted will be merged with this component defaults.
|
|
35
35
|
conf: {
|
|
36
36
|
type: Object,
|
|
37
37
|
default: () => ({}),
|
|
@@ -40,12 +40,12 @@ export default {
|
|
|
40
40
|
label: String,
|
|
41
41
|
// This is an array of validation errors that will be displayed under the editor.
|
|
42
42
|
errorMessages: Array,
|
|
43
|
-
// This set the component status to
|
|
44
|
-
|
|
43
|
+
// This set the component status to readonly, stopping the user interaction.
|
|
44
|
+
readonly: {
|
|
45
45
|
type: Boolean,
|
|
46
46
|
default: false,
|
|
47
47
|
},
|
|
48
|
-
// Use this prop to bind events. If set to true the component will emit every [
|
|
48
|
+
// Use this prop to bind events. If set to true the component will emit every [wygEditor Event](https://www.tiny.cloud/docs/advanced/events/).
|
|
49
49
|
bindevents: {
|
|
50
50
|
type: Boolean,
|
|
51
51
|
default: false,
|
|
@@ -78,7 +78,7 @@ export default {
|
|
|
78
78
|
window.tinymce.init(
|
|
79
79
|
Object.assign(defaults, this.conf, {
|
|
80
80
|
target: this.$refs.editorNode,
|
|
81
|
-
readonly: this.
|
|
81
|
+
readonly: this.readonly,
|
|
82
82
|
setup: (ctx) => this.setupEditor(ctx),
|
|
83
83
|
})
|
|
84
84
|
);
|
|
@@ -103,7 +103,7 @@ export default {
|
|
|
103
103
|
bindEvents(editor) {
|
|
104
104
|
if (this.bindevents) {
|
|
105
105
|
validEvents.forEach((eventName) => {
|
|
106
|
-
// This is a dynamic event emitter. If you activate the bindevents prop, you will be able to listen to every [
|
|
106
|
+
// This is a dynamic event emitter. If you activate the bindevents prop, you will be able to listen to every [wygEditor Event](https://www.tiny.cloud/docs/advanced/events/).
|
|
107
107
|
editor.on(eventName, (event) => this.$emit(eventName, event));
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -147,7 +147,7 @@ export default {
|
|
|
147
147
|
this.editor.setContent(val);
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
|
-
|
|
150
|
+
readonly(val) {
|
|
151
151
|
if (this.editor && this.editor.initialized) {
|
|
152
152
|
this.editor.setMode(val ? "readonly" : "design");
|
|
153
153
|
}
|
|
@@ -170,7 +170,7 @@ export default {
|
|
|
170
170
|
|
|
171
171
|
### Defaults
|
|
172
172
|
|
|
173
|
-
This is the default [
|
|
173
|
+
This is the default [wygEditor configuration](https://www.tiny.cloud/docs/configure/).
|
|
174
174
|
|
|
175
175
|
```js
|
|
176
176
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="{ child, expanded, 'spider-menu': spiderMenu }">
|
|
2
|
+
<div v-if="userCanSee" :class="{ child, expanded, 'spider-menu': spiderMenu }">
|
|
3
3
|
<v-list-item
|
|
4
4
|
:style="indent"
|
|
5
5
|
:exact-path="expanded"
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
:key="i"
|
|
30
30
|
:link="item.link"
|
|
31
31
|
:label="item.label"
|
|
32
|
+
:meta="item.meta"
|
|
32
33
|
:childrens="item.childrens"
|
|
33
34
|
:depth="(depth || 0) + 1"
|
|
34
35
|
:icon="item.icon"
|
|
@@ -113,12 +114,27 @@ export default {
|
|
|
113
114
|
activeChild() {
|
|
114
115
|
return (this.childrens || []).some((child) => this.$nuxt.$route.path.startsWith(child.link));
|
|
115
116
|
},
|
|
117
|
+
userCanSee() {
|
|
118
|
+
const middleware = this.$mapo.$auth.getRouteMiddlewares({ meta: this.meta })
|
|
119
|
+
if (middleware.includes("permissions")){
|
|
120
|
+
const userInfo = this.$mapo.$auth.user.info
|
|
121
|
+
if (userInfo.is_superuser) return true
|
|
122
|
+
const { model } = this.meta?.permissions || {}
|
|
123
|
+
const userPermission = (userInfo.user_permissions || []).filter(perm => perm.codename.endsWith(model)).map(({ codename }) => codename.replace(`_${model}`, ''))
|
|
124
|
+
return userPermission.includes('view')
|
|
125
|
+
}
|
|
126
|
+
if (middleware.includes("auth")){
|
|
127
|
+
return this.$mapo.$auth.user.isLoggedIn
|
|
128
|
+
}
|
|
129
|
+
return true
|
|
130
|
+
},
|
|
116
131
|
},
|
|
117
132
|
props: {
|
|
118
133
|
link: String,
|
|
119
134
|
label: String,
|
|
120
135
|
icon: String,
|
|
121
136
|
childrens: Array,
|
|
137
|
+
meta: Object,
|
|
122
138
|
depth: Number,
|
|
123
139
|
forceCollapse: Boolean,
|
|
124
140
|
child: Boolean,
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/uikit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.8",
|
|
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.8",
|
|
11
11
|
"@nuxtjs/vuetify": "^1.12.1"
|
|
12
12
|
},
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "4448ce925e9f3af25f78f86c3e28a88145201520"
|
|
17
17
|
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<v-checkbox
|
|
4
|
-
v-for="(option, index) in options"
|
|
5
|
-
:key="index"
|
|
6
|
-
:label="option[itemText]"
|
|
7
|
-
:input-value="isSelected(option)"
|
|
8
|
-
@change="changed($event, option)"
|
|
9
|
-
>
|
|
10
|
-
</v-checkbox>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
/**
|
|
16
|
-
* This component is made to simplify Many To Many associations. With this component you can modify an array selecting items from a list of checkboxes.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
name: "M2mField",
|
|
21
|
-
data() {
|
|
22
|
-
return {
|
|
23
|
-
proxyItems: []
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
props: {
|
|
27
|
-
// V-model property. It is the array to be modified.
|
|
28
|
-
value: {
|
|
29
|
-
type: Array,
|
|
30
|
-
required: true
|
|
31
|
-
},
|
|
32
|
-
// This is the array of options from which you can choose.
|
|
33
|
-
items: {
|
|
34
|
-
type: Array,
|
|
35
|
-
default: () => []
|
|
36
|
-
},
|
|
37
|
-
itemText: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: "text"
|
|
40
|
-
},
|
|
41
|
-
itemValue: {
|
|
42
|
-
type: String,
|
|
43
|
-
default: "*"
|
|
44
|
-
},
|
|
45
|
-
lookup: {
|
|
46
|
-
type: String,
|
|
47
|
-
default: "id"
|
|
48
|
-
},
|
|
49
|
-
endPoint: String,
|
|
50
|
-
mapping: {
|
|
51
|
-
type: Function,
|
|
52
|
-
default: items => items
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
computed: {
|
|
56
|
-
hasKey() {
|
|
57
|
-
return this.itemValue !== "*";
|
|
58
|
-
},
|
|
59
|
-
options() {
|
|
60
|
-
return this.mapping(this.proxyItems);
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
methods: {
|
|
64
|
-
isSelected(option) {
|
|
65
|
-
return !!(this.value || []).find(
|
|
66
|
-
e => e[this.lookup] == option[this.lookup]
|
|
67
|
-
);
|
|
68
|
-
},
|
|
69
|
-
changed(value, option) {
|
|
70
|
-
let val = this.hasKey ? option[this.itemValue] : option;
|
|
71
|
-
let newArr = [...(this.value || [])];
|
|
72
|
-
if (value) {
|
|
73
|
-
newArr.push(val);
|
|
74
|
-
} else {
|
|
75
|
-
let i = newArr.findIndex(e => e[this.lookup] == option[this.lookup]);
|
|
76
|
-
i !== -1 && newArr.splice(i, 1);
|
|
77
|
-
}
|
|
78
|
-
this.$emit("input", newArr);
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
watch: {
|
|
82
|
-
items(val) {
|
|
83
|
-
this.proxyItems = val;
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
mounted() {
|
|
87
|
-
if (this.endPoint && (!this.items || !this.items.length)) {
|
|
88
|
-
this.$mapo.$api
|
|
89
|
-
.crud(this.endPoint)
|
|
90
|
-
.list()
|
|
91
|
-
.then(res => (this.proxyItems = res));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
</script>
|