@mapomodule/uikit 1.0.0-alpha.0 → 1.0.0-alpha.12
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 +228 -0
- package/LICENSE.md +20 -0
- package/components/Detail/Detail.vue +209 -120
- package/components/Detail/DetailField.vue +57 -30
- package/components/Detail/DetailLangSwitch.vue +1 -1
- package/components/Detail/defaults.js +32 -25
- package/components/DropArea.vue +3 -3
- package/components/List/List.vue +100 -40
- package/components/List/ListActions.vue +56 -17
- package/components/List/ListFilters.vue +127 -113
- package/components/List/ListHead.vue +30 -12
- package/components/List/ListQuickEdit.vue +198 -55
- package/components/List/ListTable.vue +227 -78
- package/components/Login.vue +14 -5
- package/components/MediaManager/MediaEditor.vue +253 -107
- package/components/MediaManager/MediaFolders.vue +125 -41
- package/components/MediaManager/MediaGallery.vue +56 -52
- package/components/MediaManager/MediaManager.vue +114 -74
- package/components/MediaManager/MediaManagerDialog.vue +19 -22
- package/components/MediaManager/MediaPreview.vue +180 -0
- package/components/MediaManager/MediaUploader.vue +35 -32
- package/components/SnackBar.vue +3 -4
- package/components/fields/DateField.vue +9 -3
- package/components/fields/FileField.vue +108 -0
- package/components/fields/FksField.vue +60 -0
- package/components/fields/MediaField.vue +24 -6
- package/components/fields/MediaM2mField.vue +8 -3
- package/components/fields/SeoPreview.vue +89 -0
- package/components/fields/{TinyMce → wygEditor}/defaults.js +6 -4
- package/components/fields/{TinyMce → wygEditor}/utils/events.js +0 -0
- package/components/fields/{TinyMce → wygEditor}/utils/mapomedia.plugin.js +7 -6
- package/components/fields/{TinyMce → wygEditor}/utils/script.injector.js +0 -0
- package/components/fields/{TinyMce/TinyMce.vue → wygEditor/wygEditor.vue} +43 -21
- package/components/layout/Sidebar/Sidebar.vue +46 -24
- package/components/layout/Sidebar/SidebarFooter.vue +42 -46
- package/components/layout/Sidebar/SidebarList.vue +13 -14
- package/components/layout/Sidebar/SidebarListItem.vue +81 -38
- package/components/layout/Topbar/Topbar.vue +3 -36
- package/components/layout/routebuilder.js +1 -1
- package/defaults.js +2 -2
- package/layouts/default.vue +3 -14
- package/package.json +3 -3
- package/pages/index.vue +15 -78
- package/components/fields/M2mField.vue +0 -95
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<div>
|
|
3
3
|
<!-- Use this to override the title of the detail component. -->
|
|
4
4
|
<slot name="title" v-bind="slotBindings">
|
|
5
5
|
<!-- `<h1> "Create | Edit" + modelName </h1>` -->
|
|
6
|
-
<v-row class="mb-
|
|
7
|
-
<h1>{{ isNew ? "Create" : "Edit" }} {{ modelName }}</h1>
|
|
6
|
+
<v-row class="mb-5">
|
|
7
|
+
<v-col col="12"><h1 class="display-1">{{ isNew ? "Create" : "Edit" }} {{ modelName }}</h1></v-col>
|
|
8
8
|
</v-row>
|
|
9
9
|
</slot>
|
|
10
10
|
<v-form ref="form">
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<slot name="body.lang" v-bind="slotBindings">
|
|
17
17
|
<!-- [`DetailLangSwitch`](/components/detail/DetailLangSwitch/) -->
|
|
18
18
|
<DetailLangSwitch
|
|
19
|
-
v-if="langs && langs.length"
|
|
19
|
+
v-if="langs && langs.length > 1"
|
|
20
20
|
class="mb-4"
|
|
21
21
|
v-model="currentLang"
|
|
22
22
|
:langs="langs"
|
|
@@ -26,47 +26,57 @@
|
|
|
26
26
|
<slot name="body.top.underlang" v-bind="slotBindings"></slot>
|
|
27
27
|
<!-- Use this to override the content of the main body. -->
|
|
28
28
|
<slot name="body" v-bind="slotBindings">
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<v-card-text>
|
|
37
|
-
<div
|
|
38
|
-
v-for="(fields, fieldsI) in field.fields"
|
|
39
|
-
:key="fieldsI"
|
|
40
|
-
class="mb-4"
|
|
41
|
-
>
|
|
42
|
-
<!-- This is a dynamic slot. You can use it to override a field component. For example use `fields.title` to override the component of the field with value `title`. -->
|
|
43
|
-
<slot
|
|
44
|
-
:name="fields.slotName"
|
|
45
|
-
v-bind="{
|
|
46
|
-
conf: fields,
|
|
47
|
-
...slotBindings,
|
|
48
|
-
}"
|
|
49
|
-
>
|
|
50
|
-
<!-- A [`DetailField`](/components/detail/DetailField/) configured by a [`FieldConfiguration`](#fieldconfiguration). -->
|
|
51
|
-
<DetailField
|
|
52
|
-
v-model="model"
|
|
53
|
-
:conf="fields"
|
|
54
|
-
:errors="errors"
|
|
55
|
-
/>
|
|
56
|
-
</slot>
|
|
57
|
-
</div>
|
|
58
|
-
</v-card-text>
|
|
59
|
-
</v-card>
|
|
60
|
-
<slot
|
|
61
|
-
v-else
|
|
62
|
-
:name="field.slotName"
|
|
63
|
-
v-bind="{
|
|
64
|
-
conf: field,
|
|
65
|
-
...slotBindings,
|
|
66
|
-
}"
|
|
29
|
+
<div class="row">
|
|
30
|
+
<!-- The result of the [`DetailConfiguration`](#detailconfiguration) contained in the main body. -->
|
|
31
|
+
<div
|
|
32
|
+
class="col-12"
|
|
33
|
+
:class="field.class"
|
|
34
|
+
v-for="(field, index) in mainFields"
|
|
35
|
+
:key="index"
|
|
67
36
|
>
|
|
68
|
-
<
|
|
69
|
-
|
|
37
|
+
<v-card v-if="field.group" class="my-2 rounded-0">
|
|
38
|
+
<v-card-title>
|
|
39
|
+
<v-icon left> {{ field.group.icon }} </v-icon>
|
|
40
|
+
<span>{{ field.group.name }}</span>
|
|
41
|
+
</v-card-title>
|
|
42
|
+
<div class="container">
|
|
43
|
+
<div class="row">
|
|
44
|
+
<div
|
|
45
|
+
v-for="(fields, fieldsI) in field.fields"
|
|
46
|
+
:key="fieldsI"
|
|
47
|
+
class="col-12"
|
|
48
|
+
:class="fields.class"
|
|
49
|
+
>
|
|
50
|
+
<!-- This is a dynamic slot. You can use it to override a field component. For example use `fields.title` to override the component of the field with value `title`. -->
|
|
51
|
+
<slot
|
|
52
|
+
:name="fields.slotName"
|
|
53
|
+
v-bind="{
|
|
54
|
+
conf: fields,
|
|
55
|
+
...slotBindings,
|
|
56
|
+
}"
|
|
57
|
+
>
|
|
58
|
+
<!-- A [`DetailField`](/components/detail/DetailField/) configured by a [`FieldConfiguration`](#fieldconfiguration). -->
|
|
59
|
+
<DetailField
|
|
60
|
+
v-model="model"
|
|
61
|
+
:conf="fields"
|
|
62
|
+
:errors="errors"
|
|
63
|
+
/>
|
|
64
|
+
</slot>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</v-card>
|
|
69
|
+
<slot
|
|
70
|
+
v-else
|
|
71
|
+
:name="field.slotName"
|
|
72
|
+
v-bind="{
|
|
73
|
+
conf: field,
|
|
74
|
+
...slotBindings,
|
|
75
|
+
}"
|
|
76
|
+
>
|
|
77
|
+
<DetailField v-model="model" :conf="field" :errors="errors" />
|
|
78
|
+
</slot>
|
|
79
|
+
</div>
|
|
70
80
|
</div>
|
|
71
81
|
</slot>
|
|
72
82
|
<!-- Use this to add content under the main body. -->
|
|
@@ -83,14 +93,14 @@
|
|
|
83
93
|
<!-- Use this to override the Save button. -->
|
|
84
94
|
<slot name="button.save" v-bind="slotBindings">
|
|
85
95
|
<!-- The Save button. -->
|
|
86
|
-
<v-btn class="mb-2" tile block @click="saveItem(true)">{{
|
|
96
|
+
<v-btn :disabled="isReadonly" class="mb-2" tile block @click="saveItem(true)">{{
|
|
87
97
|
isNew ? "Create" : "Save"
|
|
88
98
|
}}</v-btn>
|
|
89
99
|
</slot>
|
|
90
100
|
<!-- Use this to override the Save and continue button. -->
|
|
91
101
|
<slot name="button.savecontinue" v-bind="slotBindings">
|
|
92
102
|
<!-- The Save and continue button. -->
|
|
93
|
-
<v-btn class="mb-2" tile block @click="saveItem(false)"
|
|
103
|
+
<v-btn :disabled="isReadonly" class="mb-2" tile block @click="saveItem(false)"
|
|
94
104
|
>{{ isNew ? "Create" : "Save" }} and continue</v-btn
|
|
95
105
|
>
|
|
96
106
|
</slot>
|
|
@@ -110,6 +120,7 @@
|
|
|
110
120
|
color="error"
|
|
111
121
|
tile
|
|
112
122
|
block
|
|
123
|
+
:disabled="!canDelete"
|
|
113
124
|
@click="deleteItem"
|
|
114
125
|
>Delete</v-btn
|
|
115
126
|
>
|
|
@@ -118,45 +129,55 @@
|
|
|
118
129
|
</slot>
|
|
119
130
|
<!-- Use this to add content on the top of the sidebar fields (or under sidebar buttons). -->
|
|
120
131
|
<slot name="side.top" v-bind="slotBindings"></slot>
|
|
121
|
-
<div
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
<v-card-text>
|
|
128
|
-
<div
|
|
129
|
-
v-for="(fields, fieldsI) in field.fields"
|
|
130
|
-
:key="fieldsI"
|
|
131
|
-
class="mb-4"
|
|
132
|
-
>
|
|
133
|
-
<!-- @vuese-ignore -->
|
|
134
|
-
<slot
|
|
135
|
-
:name="fields.slotName"
|
|
136
|
-
v-bind="{
|
|
137
|
-
conf: fields,
|
|
138
|
-
...slotBindings,
|
|
139
|
-
}"
|
|
140
|
-
>
|
|
141
|
-
<DetailField
|
|
142
|
-
v-model="model"
|
|
143
|
-
:conf="fields"
|
|
144
|
-
:errors="errors"
|
|
145
|
-
/>
|
|
146
|
-
</slot>
|
|
147
|
-
</div>
|
|
148
|
-
</v-card-text>
|
|
149
|
-
</v-card>
|
|
150
|
-
<slot
|
|
151
|
-
v-else
|
|
152
|
-
:name="field.slotName"
|
|
153
|
-
v-bind="{
|
|
154
|
-
conf: field,
|
|
155
|
-
...slotBindings,
|
|
156
|
-
}"
|
|
132
|
+
<div class="row">
|
|
133
|
+
<div
|
|
134
|
+
class="col-12"
|
|
135
|
+
:class="field.class"
|
|
136
|
+
v-for="(field, index) in sideFields"
|
|
137
|
+
:key="index"
|
|
157
138
|
>
|
|
158
|
-
<
|
|
159
|
-
|
|
139
|
+
<v-card v-if="field.group" class="rounded-0 mb-4">
|
|
140
|
+
<v-card-title>
|
|
141
|
+
<v-icon left> {{ field.group.icon }} </v-icon>
|
|
142
|
+
<span>{{ field.group.name }}</span>
|
|
143
|
+
</v-card-title>
|
|
144
|
+
<div class="container">
|
|
145
|
+
<div class="row">
|
|
146
|
+
<div
|
|
147
|
+
v-for="(fields, fieldsI) in field.fields"
|
|
148
|
+
:key="fieldsI"
|
|
149
|
+
class="col-12"
|
|
150
|
+
:class="field.class"
|
|
151
|
+
>
|
|
152
|
+
<!-- @vuese-ignore -->
|
|
153
|
+
<slot
|
|
154
|
+
:name="fields.slotName"
|
|
155
|
+
v-bind="{
|
|
156
|
+
conf: fields,
|
|
157
|
+
...slotBindings,
|
|
158
|
+
}"
|
|
159
|
+
>
|
|
160
|
+
<DetailField
|
|
161
|
+
v-model="model"
|
|
162
|
+
:conf="fields"
|
|
163
|
+
:errors="errors"
|
|
164
|
+
/>
|
|
165
|
+
</slot>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
</v-card>
|
|
170
|
+
<slot
|
|
171
|
+
v-else
|
|
172
|
+
:name="field.slotName"
|
|
173
|
+
v-bind="{
|
|
174
|
+
conf: field,
|
|
175
|
+
...slotBindings,
|
|
176
|
+
}"
|
|
177
|
+
>
|
|
178
|
+
<DetailField v-model="model" :conf="field" :errors="errors" />
|
|
179
|
+
</slot>
|
|
180
|
+
</div>
|
|
160
181
|
</div>
|
|
161
182
|
<!-- Use this to add content under the sidebar fields. -->
|
|
162
183
|
<slot name="side.bottom" v-bind="slotBindings"></slot>
|
|
@@ -164,7 +185,7 @@
|
|
|
164
185
|
</v-col>
|
|
165
186
|
</v-row>
|
|
166
187
|
</v-form>
|
|
167
|
-
</
|
|
188
|
+
</div>
|
|
168
189
|
</template>
|
|
169
190
|
|
|
170
191
|
|
|
@@ -183,6 +204,16 @@ export default {
|
|
|
183
204
|
};
|
|
184
205
|
},
|
|
185
206
|
props: {
|
|
207
|
+
// V-model of the object we are editing.
|
|
208
|
+
value: {
|
|
209
|
+
type: Object,
|
|
210
|
+
required: false
|
|
211
|
+
},
|
|
212
|
+
// Set the current lang to value.
|
|
213
|
+
lang: {
|
|
214
|
+
type: String,
|
|
215
|
+
required: false
|
|
216
|
+
},
|
|
186
217
|
// The main configuration that determines the arrangement of the fields in the detail layout.
|
|
187
218
|
fields: {
|
|
188
219
|
// [`DetailConfiguration`](#detailconfiguration)
|
|
@@ -195,7 +226,10 @@ export default {
|
|
|
195
226
|
default: () => []
|
|
196
227
|
},
|
|
197
228
|
// The url of the endpoint to which the payload is to be sent. From this url a complete crud (See [this.$mapo.$api.crud](/core/#$api.crud)) will be created.
|
|
198
|
-
endpoint:
|
|
229
|
+
endpoint: {
|
|
230
|
+
type: String,
|
|
231
|
+
default: null
|
|
232
|
+
},
|
|
199
233
|
// The identifier of the object you need to retrieve and edit. It can be "new" if you need to create a new payload.
|
|
200
234
|
identifier: {
|
|
201
235
|
// `String|Number`.
|
|
@@ -208,20 +242,29 @@ export default {
|
|
|
208
242
|
sticky: {
|
|
209
243
|
type: Boolean,
|
|
210
244
|
default: true
|
|
211
|
-
}
|
|
245
|
+
},
|
|
246
|
+
// Set the multipart politic. Accepts `'auto'|'force|'disable'`. If auto is set the request is transformed in multipart if any file is in the payload. If set to force the request is transformed in multipart no matter if files are found. If set to `'disable'` the request is never transformed in multipart.
|
|
247
|
+
multipart: {
|
|
248
|
+
type: String,
|
|
249
|
+
default: "auto",
|
|
250
|
+
validator: function (value) {
|
|
251
|
+
// The value must match one of these strings
|
|
252
|
+
return ["auto", "force", "disable"].indexOf(value) !== -1;
|
|
253
|
+
},
|
|
254
|
+
},
|
|
212
255
|
},
|
|
213
256
|
methods: {
|
|
214
257
|
saveItem(back = false) {
|
|
215
258
|
this.errors = null;
|
|
216
259
|
this.$refs.form?.resetValidation();
|
|
217
260
|
this.crud
|
|
218
|
-
.updateOrCreate(this.model)
|
|
219
|
-
.then(() => back
|
|
261
|
+
.updateOrCreate(this.model, {}, { multipart: this.multipart })
|
|
262
|
+
.then((resp) => { back ? this.$router.back() : this.model = resp })
|
|
220
263
|
.catch(error => {
|
|
221
264
|
this.errors =
|
|
222
265
|
(error.response.status == 400 && error.response.data) || null;
|
|
223
266
|
this.$mapo.$snack.open({
|
|
224
|
-
message: "Something whent bad, please try again later...",
|
|
267
|
+
message: error.response?.data?.detail || "Something whent bad, please try again later...",
|
|
225
268
|
color: "error"
|
|
226
269
|
});
|
|
227
270
|
});
|
|
@@ -231,7 +274,7 @@ export default {
|
|
|
231
274
|
.open({
|
|
232
275
|
title: "Delete",
|
|
233
276
|
question: "Are you sure you want to delete this item?",
|
|
234
|
-
approveButton: { text: "Delete", attrs: { color: "red" } }
|
|
277
|
+
approveButton: { text: "Delete", attrs: { color: "red", text: true } }
|
|
235
278
|
})
|
|
236
279
|
.then(res => {
|
|
237
280
|
if (res) {
|
|
@@ -240,19 +283,32 @@ export default {
|
|
|
240
283
|
.then(() => this.$router.back())
|
|
241
284
|
.catch(error =>
|
|
242
285
|
this.$mapo.$snack.open({
|
|
243
|
-
message: "Something whent bad, please try again later...",
|
|
286
|
+
message: error.response?.data?.detail || "Something whent bad, please try again later...",
|
|
244
287
|
color: "error"
|
|
245
288
|
})
|
|
246
289
|
);
|
|
247
290
|
}
|
|
248
291
|
});
|
|
249
292
|
},
|
|
250
|
-
|
|
293
|
+
initLang(lang = this.currentLang) {
|
|
294
|
+
if (lang && !this.model.translations) {
|
|
295
|
+
this.model.translations = {};
|
|
296
|
+
}
|
|
297
|
+
if (lang && !this.model.translations[lang]) {
|
|
298
|
+
this.model.translations[lang] = {};
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
parseConf(field, i) {
|
|
251
302
|
const conf = typeof field === "string" ? { value: field } : field;
|
|
252
|
-
conf.value = conf.value
|
|
253
|
-
conf.
|
|
303
|
+
conf.value = conf.value || "";
|
|
304
|
+
conf.value = conf.value.replace(new RegExp(`^translations\.(${this.langs.join("|")})\.?`), "");
|
|
305
|
+
conf.slotName = `fields.${conf.value || i}`;
|
|
254
306
|
if (this.currentLang && !field.synci18n) {
|
|
255
|
-
|
|
307
|
+
const base = `translations.${this.currentLang}`;
|
|
308
|
+
conf.value = (conf.value && `${base}.${conf.value}`) || base;
|
|
309
|
+
}
|
|
310
|
+
if (this.isReadonly){
|
|
311
|
+
conf.attrs = {...conf.attrs, readonly: true}
|
|
256
312
|
}
|
|
257
313
|
return conf;
|
|
258
314
|
},
|
|
@@ -261,21 +317,35 @@ export default {
|
|
|
261
317
|
const parseGroup = group =>
|
|
262
318
|
typeof group === "string"
|
|
263
319
|
? { name: group, icon }
|
|
264
|
-
: { ...group, icon: group.icon
|
|
265
|
-
return fields.map(f =>
|
|
320
|
+
: { ...group, icon: group.icon !== undefined ? group.icon : icon };
|
|
321
|
+
return fields.map((f, i) =>
|
|
266
322
|
f.group
|
|
267
323
|
? { group: parseGroup(f.group), fields: this.mapConf(f.fields) }
|
|
268
|
-
: this.parseConf(f)
|
|
324
|
+
: this.parseConf(f, i)
|
|
269
325
|
);
|
|
270
326
|
}
|
|
271
327
|
},
|
|
272
328
|
watch: {
|
|
273
329
|
currentLang(val) {
|
|
274
|
-
|
|
275
|
-
|
|
330
|
+
this.initLang();
|
|
331
|
+
// Fired when the current language changes.
|
|
332
|
+
// @arg Emits the language name as a string.
|
|
333
|
+
this.$emit("update:lang", val);
|
|
334
|
+
},
|
|
335
|
+
model(val) {
|
|
336
|
+
// Fired when the v-model changes.
|
|
337
|
+
// @arg Emits the entire payload modified.
|
|
338
|
+
this.$emit("input", val);
|
|
339
|
+
},
|
|
340
|
+
lang(val) {
|
|
341
|
+
if (val && this.langs.includes(val)) {
|
|
342
|
+
this.currentLang = val;
|
|
276
343
|
}
|
|
277
|
-
|
|
278
|
-
|
|
344
|
+
},
|
|
345
|
+
value(val) {
|
|
346
|
+
if (val) {
|
|
347
|
+
this.model = val;
|
|
348
|
+
this.initLang();
|
|
279
349
|
}
|
|
280
350
|
}
|
|
281
351
|
},
|
|
@@ -283,6 +353,18 @@ export default {
|
|
|
283
353
|
crud() {
|
|
284
354
|
return this.$mapo.$api.crud(this.endpoint);
|
|
285
355
|
},
|
|
356
|
+
isReadonly() {
|
|
357
|
+
if (this.$mapo.$auth.routeMiddlewares.includes("permissions")){
|
|
358
|
+
return !this.$mapo.$auth.user.permissions.includes(this.isNew ? "add" : "change")
|
|
359
|
+
}
|
|
360
|
+
return false
|
|
361
|
+
},
|
|
362
|
+
canDelete() {
|
|
363
|
+
if (this.$mapo.$auth.routeMiddlewares.includes("permissions")){
|
|
364
|
+
return this.$mapo.$auth.user.permissions.includes("delete")
|
|
365
|
+
}
|
|
366
|
+
return true
|
|
367
|
+
},
|
|
286
368
|
mainFields() {
|
|
287
369
|
return this.mapConf(
|
|
288
370
|
this.fields instanceof Array ? this.fields : this.fields.main || []
|
|
@@ -304,7 +386,7 @@ export default {
|
|
|
304
386
|
},
|
|
305
387
|
langs() {
|
|
306
388
|
return (
|
|
307
|
-
this.model?.
|
|
389
|
+
this.model?.lang_info?.site_languages.map(l => l.id) || this.languages
|
|
308
390
|
);
|
|
309
391
|
},
|
|
310
392
|
slotBindings() {
|
|
@@ -331,7 +413,13 @@ export default {
|
|
|
331
413
|
},
|
|
332
414
|
mounted() {
|
|
333
415
|
if (this.identifier && this.identifier !== "new") {
|
|
334
|
-
this.crud.detail(this.identifier).then(res =>
|
|
416
|
+
this.crud.detail(this.identifier).then(res => {
|
|
417
|
+
this.model = res;
|
|
418
|
+
this.initLang();
|
|
419
|
+
});
|
|
420
|
+
} else if (this.value) {
|
|
421
|
+
this.model = this.value;
|
|
422
|
+
this.initLang();
|
|
335
423
|
}
|
|
336
424
|
}
|
|
337
425
|
};
|
|
@@ -341,7 +429,7 @@ export default {
|
|
|
341
429
|
|
|
342
430
|
## DetailConfiguration
|
|
343
431
|
|
|
344
|
-
The DetailConfiguration determines the behavior of the main form and is an `Array` of [`FieldConfiguration`](#fieldconfiguration).
|
|
432
|
+
The DetailConfiguration determines the behavior of the main form and is an `Array` of [`FieldConfiguration`](#fieldconfiguration).
|
|
345
433
|
Each field configuration represents a field of the form.
|
|
346
434
|
The configuration can also consist of an object with two keys `{ main sidenav }`.
|
|
347
435
|
Each key is an `Array` of [`FieldConfiguration`](#fieldconfiguration) and will modify a different part of the component:
|
|
@@ -351,7 +439,7 @@ Each key is an `Array` of [`FieldConfiguration`](#fieldconfiguration) and will m
|
|
|
351
439
|
|
|
352
440
|
### FieldConfiguration
|
|
353
441
|
|
|
354
|
-
The `FieldConfiguration` is a `String` containing the dottedPath of a value inside the payload we want to modify.
|
|
442
|
+
The `FieldConfiguration` is a `String` containing the dottedPath of a value inside the payload we want to modify.
|
|
355
443
|
So, for example, if we have the payload: `{ image: { name: "...", url: "..." } }` we can modify the image name using the dottedPath `"image.name"`.
|
|
356
444
|
|
|
357
445
|
The default component used to render a field of a form is a [`v-text-field`](https://vuetifyjs.com/en/components/text-fields/).
|
|
@@ -359,12 +447,12 @@ If you want more control over the generated component you can use an `Object` wi
|
|
|
359
447
|
|
|
360
448
|
|Name|Description|Type|Required|Default|
|
|
361
449
|
|---|---|---|---|---|
|
|
362
|
-
|value|The dottedPath of the value we want to modify.|`String`|`true`|-|
|
|
363
|
-
|synci18n|Determines if the field is translatable or not. If set to true the value will remain the same in all translations (untranslatable).|`Boolean`|`false`|`false`|
|
|
364
|
-
|type|Type of the field. This determines which component will be rendered. The list of possible choices can be found [here](#field-types) |`String`|`false`|`text`|
|
|
365
|
-
|accessor|[`Accessor`](#accessor) object to specify the setter and the getter of the field.|`Object`|`false`|`{set: x=>x, get: x=>x}`|
|
|
366
|
-
|attrs|The attributes that will be passed to the component.|`Object`|`false`|-|
|
|
367
|
-
|is|The component to be rendered in the form. This has a higher priority than the "type" attribute. Here you can pass in any regitered Vue component instance or name. [Learn more](https://vuejs.org/v2/guide/components.html#Dynamic-Components).|`String | VueComponent`|`false`|-|
|
|
450
|
+
|value|The dottedPath of the value we want to modify.|`String`|`true`|-|
|
|
451
|
+
|synci18n|Determines if the field is translatable or not. If set to true the value will remain the same in all translations (untranslatable).|`Boolean`|`false`|`false`|
|
|
452
|
+
|type|Type of the field. This determines which component will be rendered. The list of possible choices can be found [here](#field-types) |`String`|`false`|`text`|
|
|
453
|
+
|accessor|[`Accessor`](#accessor) object to specify the setter and the getter of the field.|`Object`|`false`|`{set: x=>x, get: x=>x}`|
|
|
454
|
+
|attrs|The attributes that will be passed to the component.|`Object`|`false`|-|
|
|
455
|
+
|is|The component to be rendered in the form. This has a higher priority than the "type" attribute. Here you can pass in any regitered Vue component instance or name. [Learn more](https://vuejs.org/v2/guide/components.html#Dynamic-Components).|`String | VueComponent`|`false`|-|
|
|
368
456
|
|
|
369
457
|
#### Accessor
|
|
370
458
|
|
|
@@ -374,7 +462,7 @@ Each function must return the processed value.
|
|
|
374
462
|
|
|
375
463
|
#### Field types
|
|
376
464
|
|
|
377
|
-
Here the list of the FieldConfiguration type association.
|
|
465
|
+
Here the list of the FieldConfiguration type association.
|
|
378
466
|
|
|
379
467
|
- `text` ==> [v-text-field](https://vuetifyjs.com/en/components/text-fields/),
|
|
380
468
|
- `select` ==> [v-select](https://vuetifyjs.com/en/components/selects/),
|
|
@@ -383,10 +471,10 @@ Here the list of the FieldConfiguration type association.
|
|
|
383
471
|
- `switch` ==> [v-switch](https://vuetifyjs.com/en/components/switches/),
|
|
384
472
|
- `slider` ==> [v-slider](https://vuetifyjs.com/en/components/sliders/),
|
|
385
473
|
- `file` ==> [v-file-input](https://vuetifyjs.com/en/components/file-inputs/),
|
|
386
|
-
- `editor` ==> [
|
|
474
|
+
- `editor` ==> [wyg-editor](/components/fields/wygEditor/wygEditor/),
|
|
387
475
|
- `media` ==> [media-field](/components/fields/MediaField/),
|
|
388
|
-
- `m2m` ==> [
|
|
389
|
-
- `mediaList` ==> [media-
|
|
476
|
+
- `m2m` or `fks` ==> [fks-field](/components/fields/FksField/),
|
|
477
|
+
- `mediaList` ==> [media-fks-field](/components/fields/MediaM2mField/)
|
|
390
478
|
|
|
391
479
|
|
|
392
480
|
#### Example of a [`FieldConfiguration`](#fieldconfiguration):
|
|
@@ -405,8 +493,8 @@ Here the list of the FieldConfiguration type association.
|
|
|
405
493
|
|
|
406
494
|
### FieldGroup
|
|
407
495
|
|
|
408
|
-
You can use this mixed with `FieldConfiguration` to group multiple fields in one card with a title and an icon.
|
|
409
|
-
The `FieldGroup` has the key group that is a string repreenting the name of the group and the key fields that is an `Array` of [`FieldConfiguration`](#fieldconfiguration).
|
|
496
|
+
You can use this mixed with `FieldConfiguration` to group multiple fields in one card with a title and an icon.
|
|
497
|
+
The `FieldGroup` has the key group that is a string repreenting the name of the group and the key fields that is an `Array` of [`FieldConfiguration`](#fieldconfiguration).
|
|
410
498
|
The group key can also be an `Object`. In that case it contains the name and the icon for the group `{name: "...", icon: "..."}`. For a list of all available icons, visit the official [Material Design Icons](https://materialdesignicons.com/) page.
|
|
411
499
|
|
|
412
500
|
<br><br>
|
|
@@ -446,6 +534,7 @@ export default {
|
|
|
446
534
|
"title",
|
|
447
535
|
{ value: "description", type: "textarea" },
|
|
448
536
|
"permalink",
|
|
537
|
+
{ type: "seoPreview" }
|
|
449
538
|
]
|
|
450
539
|
}
|
|
451
540
|
],
|
|
@@ -486,4 +575,4 @@ export default {
|
|
|
486
575
|
|
|
487
576
|
|
|
488
577
|
|
|
489
|
-
</docs>
|
|
578
|
+
</docs>
|