@mapomodule/uikit 1.0.0-alpha.20 → 1.0.0-alpha.23
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 +62 -0
- package/components/Detail/Detail.vue +240 -359
- package/components/Form/Form.vue +228 -0
- package/components/{Detail/DetailField.vue → Form/FormField.vue} +35 -15
- package/components/Form/FormGroup.vue +94 -0
- package/components/Form/FormTabs.vue +139 -0
- package/components/{Detail → Form}/defaults.js +0 -0
- package/components/{fields → Form/fields}/DateField.vue +0 -0
- package/components/{fields → Form/fields}/FileField.vue +0 -0
- package/components/{fields → Form/fields}/FksField.vue +0 -0
- package/components/{fields → Form/fields}/MediaField.vue +0 -0
- package/components/{fields → Form/fields}/MediaM2mField.vue +0 -0
- package/components/Form/fields/Repeater.vue +575 -0
- package/components/{fields → Form/fields}/SeoPreview.vue +6 -2
- package/components/{fields → Form/fields}/wygEditor/defaults.js +0 -0
- package/components/{fields → Form/fields}/wygEditor/utils/events.js +0 -0
- package/components/{fields → Form/fields}/wygEditor/utils/mapomedia.plugin.js +0 -0
- package/components/{fields → Form/fields}/wygEditor/utils/script.injector.js +0 -0
- package/components/{fields → Form/fields}/wygEditor/wygEditor.vue +0 -0
- package/components/List/ListQuickEdit.vue +17 -100
- package/components/List/ListTable.vue +4 -6
- package/module.js +1 -1
- package/package.json +3 -3
- package/components/fields/Repeater.vue +0 -338
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<div v-
|
|
3
|
+
<div v-if="loading">
|
|
4
4
|
<v-progress-linear
|
|
5
5
|
color="primary"
|
|
6
6
|
indeterminate
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
Fetching data..
|
|
13
13
|
</span>
|
|
14
14
|
</div>
|
|
15
|
-
<div v-
|
|
15
|
+
<div v-else>
|
|
16
16
|
<!-- Use this to override the title of the detail component. -->
|
|
17
17
|
<slot name="title" v-bind="slotBindings">
|
|
18
18
|
<!-- `<h1> "Create | Edit" + modelName </h1>` -->
|
|
@@ -40,66 +40,24 @@
|
|
|
40
40
|
<slot name="body.top.underlang" v-bind="slotBindings"></slot>
|
|
41
41
|
<!-- Use this to override the content of the main body. -->
|
|
42
42
|
<slot name="body" v-bind="slotBindings">
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class="col-12"
|
|
62
|
-
:class="fields.class"
|
|
63
|
-
>
|
|
64
|
-
<!-- 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`. -->
|
|
65
|
-
<slot
|
|
66
|
-
:name="fields.slotName"
|
|
67
|
-
v-bind="{
|
|
68
|
-
conf: fields,
|
|
69
|
-
...slotBindings,
|
|
70
|
-
}"
|
|
71
|
-
>
|
|
72
|
-
<!-- A [`DetailField`](/components/detail/DetailField/) configured by a [`FieldConfiguration`](#fieldconfiguration). -->
|
|
73
|
-
<DetailField
|
|
74
|
-
v-model="model"
|
|
75
|
-
:langs="langs"
|
|
76
|
-
:currentLang="currentLang"
|
|
77
|
-
:conf="fields"
|
|
78
|
-
:errors="errors"
|
|
79
|
-
/>
|
|
80
|
-
</slot>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</v-card>
|
|
85
|
-
<slot
|
|
86
|
-
v-else
|
|
87
|
-
:name="field.slotName"
|
|
88
|
-
v-bind="{
|
|
89
|
-
conf: field,
|
|
90
|
-
...slotBindings,
|
|
91
|
-
}"
|
|
92
|
-
>
|
|
93
|
-
<DetailField
|
|
94
|
-
v-model="model"
|
|
95
|
-
:langs="langs"
|
|
96
|
-
:currentLang="currentLang"
|
|
97
|
-
:conf="field"
|
|
98
|
-
:errors="errors"
|
|
99
|
-
/>
|
|
100
|
-
</slot>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
43
|
+
<Form
|
|
44
|
+
v-model="model"
|
|
45
|
+
:currentLang="currentLang"
|
|
46
|
+
:languages="langs"
|
|
47
|
+
:errors="errors"
|
|
48
|
+
:fields="mainFields"
|
|
49
|
+
:moreSlotBindings="slotBindings"
|
|
50
|
+
:readonly="isReadonly"
|
|
51
|
+
>
|
|
52
|
+
<template v-for="(_, slot) in $slots" :slot="slot">
|
|
53
|
+
<!-- @vuese-ignore -->
|
|
54
|
+
<slot :name="slot"></slot>
|
|
55
|
+
</template>
|
|
56
|
+
<template v-for="(_, slot) in $scopedSlots" v-slot:[slot]="props">
|
|
57
|
+
<!-- @vuese-ignore -->
|
|
58
|
+
<slot :name="slot" v-bind="props" />
|
|
59
|
+
</template>
|
|
60
|
+
</Form>
|
|
103
61
|
</slot>
|
|
104
62
|
<!-- Use this to add content under the main body. -->
|
|
105
63
|
<slot name="body.bottom" v-bind="slotBindings"></slot>
|
|
@@ -151,64 +109,23 @@
|
|
|
151
109
|
</slot>
|
|
152
110
|
<!-- Use this to add content on the top of the sidebar fields (or under sidebar buttons). -->
|
|
153
111
|
<slot name="side.top" v-bind="slotBindings"></slot>
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
class="col-12"
|
|
172
|
-
:class="field.class"
|
|
173
|
-
>
|
|
174
|
-
<!-- @vuese-ignore -->
|
|
175
|
-
<slot
|
|
176
|
-
:name="fields.slotName"
|
|
177
|
-
v-bind="{
|
|
178
|
-
conf: fields,
|
|
179
|
-
...slotBindings,
|
|
180
|
-
}"
|
|
181
|
-
>
|
|
182
|
-
<DetailField
|
|
183
|
-
v-model="model"
|
|
184
|
-
:langs="langs"
|
|
185
|
-
:currentLang="currentLang"
|
|
186
|
-
:conf="fields"
|
|
187
|
-
:errors="errors"
|
|
188
|
-
/>
|
|
189
|
-
</slot>
|
|
190
|
-
</div>
|
|
191
|
-
</div>
|
|
192
|
-
</div>
|
|
193
|
-
</v-card>
|
|
194
|
-
<slot
|
|
195
|
-
v-else
|
|
196
|
-
:name="field.slotName"
|
|
197
|
-
v-bind="{
|
|
198
|
-
conf: field,
|
|
199
|
-
...slotBindings,
|
|
200
|
-
}"
|
|
201
|
-
>
|
|
202
|
-
<DetailField
|
|
203
|
-
v-model="model"
|
|
204
|
-
:langs="langs"
|
|
205
|
-
:currentLang="currentLang"
|
|
206
|
-
:conf="field"
|
|
207
|
-
:errors="errors"
|
|
208
|
-
/>
|
|
209
|
-
</slot>
|
|
210
|
-
</div>
|
|
211
|
-
</div>
|
|
112
|
+
<Form
|
|
113
|
+
v-model="model"
|
|
114
|
+
:currentLang="currentLang"
|
|
115
|
+
:languages="langs"
|
|
116
|
+
:errors="errors"
|
|
117
|
+
:fields="sideFields"
|
|
118
|
+
:moreSlotBindings="slotBindings"
|
|
119
|
+
>
|
|
120
|
+
<template v-for="(_, slot) in $slots" :slot="slot">
|
|
121
|
+
<!-- @vuese-ignore -->
|
|
122
|
+
<slot :name="slot"></slot>
|
|
123
|
+
</template>
|
|
124
|
+
<template v-for="(_, slot) in $scopedSlots" v-slot:[slot]="props">
|
|
125
|
+
<!-- @vuese-ignore -->
|
|
126
|
+
<slot :name="slot" v-bind="props" />
|
|
127
|
+
</template>
|
|
128
|
+
</Form>
|
|
212
129
|
<!-- Use this to add content under the sidebar fields. -->
|
|
213
130
|
<slot name="side.bottom" v-bind="slotBindings"></slot>
|
|
214
131
|
</div>
|
|
@@ -238,246 +155,210 @@
|
|
|
238
155
|
* A use case example could be "build a page that allows you to change the specifications of a product for an ecommerce".<br> <h4>Index:</h4> [[toc]]
|
|
239
156
|
*/
|
|
240
157
|
export default {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
},
|
|
250
|
-
props: {
|
|
251
|
-
// V-model of the object we are editing.
|
|
252
|
-
value: {
|
|
253
|
-
type: Object,
|
|
254
|
-
required: false
|
|
255
|
-
},
|
|
256
|
-
// Set the current lang to value.
|
|
257
|
-
lang: {
|
|
258
|
-
type: String,
|
|
259
|
-
required: false
|
|
260
|
-
},
|
|
261
|
-
// The main configuration that determines the arrangement of the fields in the detail layout.
|
|
262
|
-
fields: {
|
|
263
|
-
// [`DetailConfiguration`](#detailconfiguration)
|
|
264
|
-
type: Object | Array,
|
|
265
|
-
required: true
|
|
266
|
-
},
|
|
267
|
-
// A list of languages into which the payload needs to be translated.
|
|
268
|
-
languages: {
|
|
269
|
-
type: Array,
|
|
270
|
-
default: () => []
|
|
158
|
+
name: "Detail",
|
|
159
|
+
data() {
|
|
160
|
+
return {
|
|
161
|
+
model: {},
|
|
162
|
+
modelLanguages: [],
|
|
163
|
+
currentLang: this.lang,
|
|
164
|
+
errors: null
|
|
165
|
+
};
|
|
271
166
|
},
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
167
|
+
props: {
|
|
168
|
+
// V-model of the object we are editing.
|
|
169
|
+
value: {
|
|
170
|
+
type: Object,
|
|
171
|
+
required: false
|
|
172
|
+
},
|
|
173
|
+
// Set the current lang to value.
|
|
174
|
+
lang: {
|
|
175
|
+
type: String,
|
|
176
|
+
required: false
|
|
177
|
+
},
|
|
178
|
+
// The main configuration that determines the arrangement of the fields in the detail layout.
|
|
179
|
+
fields: {
|
|
180
|
+
// [`DetailConfiguration`](#detailconfiguration)
|
|
181
|
+
type: Object | Array,
|
|
182
|
+
required: true
|
|
183
|
+
},
|
|
184
|
+
// A list of languages into which the payload needs to be translated.
|
|
185
|
+
languages: {
|
|
186
|
+
type: Array,
|
|
187
|
+
default: () => []
|
|
188
|
+
},
|
|
189
|
+
// 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.
|
|
190
|
+
endpoint: {
|
|
191
|
+
type: String,
|
|
192
|
+
default: null
|
|
193
|
+
},
|
|
194
|
+
// The identifier of the object you need to retrieve and edit. It can be "new" if you need to create a new payload.
|
|
195
|
+
identifier: {
|
|
196
|
+
// `String|Number`.
|
|
197
|
+
type: String | Number,
|
|
198
|
+
default: "new"
|
|
199
|
+
},
|
|
200
|
+
// The title of the detail page.
|
|
201
|
+
modelName: String,
|
|
202
|
+
// This determines the style of the sidebar. If set to true the sidebar will remain sticky during the scroll.
|
|
203
|
+
sticky: {
|
|
204
|
+
type: Boolean,
|
|
205
|
+
default: true
|
|
206
|
+
},
|
|
207
|
+
// 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.
|
|
208
|
+
multipart: {
|
|
209
|
+
type: String,
|
|
210
|
+
default: "auto",
|
|
211
|
+
validator: function (value) {
|
|
212
|
+
// The value must match one of these strings
|
|
213
|
+
return ["auto", "force", "disable"].indexOf(value) !== -1;
|
|
214
|
+
},
|
|
215
|
+
},
|
|
318
216
|
},
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
.then(res => {
|
|
327
|
-
if (res) {
|
|
217
|
+
methods: {
|
|
218
|
+
back() {
|
|
219
|
+
this.$nuxt.context?.from?.name == "login" ? this.$router.go(-3) : this.$router.back();
|
|
220
|
+
},
|
|
221
|
+
saveItem(back = false) {
|
|
222
|
+
this.errors = null;
|
|
223
|
+
this.$refs.form?.resetValidation();
|
|
328
224
|
this.crud
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
225
|
+
.updateOrCreate(this.model, {}, { multipart: this.multipart })
|
|
226
|
+
.then((resp) => {
|
|
227
|
+
if (back) {
|
|
228
|
+
this.back()
|
|
229
|
+
} else {
|
|
230
|
+
this.model = resp;
|
|
231
|
+
this.isNew && this.$router.replace({ params: { detail: resp.id } })
|
|
232
|
+
}
|
|
335
233
|
})
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
const parseGroup = group =>
|
|
365
|
-
typeof group === "string"
|
|
366
|
-
? { name: group, icon }
|
|
367
|
-
: { ...group, icon: group.icon !== undefined ? group.icon : icon };
|
|
368
|
-
return fields.map((f, i) =>
|
|
369
|
-
f.group
|
|
370
|
-
? { group: parseGroup(f.group), fields: this.mapConf(f.fields) }
|
|
371
|
-
: this.parseConf(f, i)
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
},
|
|
375
|
-
watch: {
|
|
376
|
-
currentLang(val) {
|
|
377
|
-
this.initLang();
|
|
378
|
-
// Fired when the current language changes.
|
|
379
|
-
// @arg Emits the language name as a string.
|
|
380
|
-
this.$emit("update:lang", val);
|
|
381
|
-
},
|
|
382
|
-
model(val) {
|
|
383
|
-
// Fired when the v-model changes.
|
|
384
|
-
// @arg Emits the entire payload modified.
|
|
385
|
-
this.$emit("input", val);
|
|
386
|
-
},
|
|
387
|
-
lang(val) {
|
|
388
|
-
if (val && this.langs.includes(val)) {
|
|
389
|
-
this.currentLang = val;
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
value(val) {
|
|
393
|
-
if (val) {
|
|
394
|
-
this.model = val;
|
|
395
|
-
this.initLang();
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
},
|
|
399
|
-
computed: {
|
|
400
|
-
canGoBack() {
|
|
401
|
-
if (typeof window !== "undefined") {
|
|
402
|
-
return this.$nuxt?.context?.from?.name !== "login" && window.history.length > 1 || window.history.length > 3
|
|
403
|
-
}
|
|
404
|
-
return true;
|
|
405
|
-
},
|
|
406
|
-
crud() {
|
|
407
|
-
return this.$mapo.$api.crud(this.endpoint);
|
|
408
|
-
},
|
|
409
|
-
isReadonly() {
|
|
410
|
-
if (this.$mapo.$auth.routeMiddlewares.includes("permissions")){
|
|
411
|
-
return !this.$mapo.$auth.user.permissions.includes(this.isNew ? "add" : "change")
|
|
412
|
-
}
|
|
413
|
-
return false
|
|
414
|
-
},
|
|
415
|
-
canDelete() {
|
|
416
|
-
if (this.$mapo.$auth.routeMiddlewares.includes("permissions")){
|
|
417
|
-
return this.$mapo.$auth.user.permissions.includes("delete")
|
|
418
|
-
}
|
|
419
|
-
return true
|
|
420
|
-
},
|
|
421
|
-
mainFields() {
|
|
422
|
-
return this.mapConf(
|
|
423
|
-
this.fields instanceof Array ? this.fields : this.fields.main || []
|
|
424
|
-
);
|
|
425
|
-
},
|
|
426
|
-
sideFields() {
|
|
427
|
-
return this.mapConf(
|
|
428
|
-
(this.fields instanceof Object && this.fields.sidenav) || []
|
|
429
|
-
);
|
|
430
|
-
},
|
|
431
|
-
isNew() {
|
|
432
|
-
return this.identifier && this.identifier == "new";
|
|
234
|
+
.catch(error => {
|
|
235
|
+
this.errors =
|
|
236
|
+
(error.response.status == 400 && error.response.data) || null;
|
|
237
|
+
this.$mapo.$snack.open({
|
|
238
|
+
message: error.response?.data?.detail || "Something whent bad, please try again later...",
|
|
239
|
+
color: "error"
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
deleteItem() {
|
|
244
|
+
this.$mapo.$confirm
|
|
245
|
+
.open({
|
|
246
|
+
title: "Delete",
|
|
247
|
+
question: "Are you sure you want to delete this item?",
|
|
248
|
+
approveButton: { text: "Delete", attrs: { color: "red", text: true } }
|
|
249
|
+
})
|
|
250
|
+
.then(res => {
|
|
251
|
+
if (res) {
|
|
252
|
+
this.crud
|
|
253
|
+
.delete(this.identifier)
|
|
254
|
+
.then(() => this.back())
|
|
255
|
+
.catch(error => this.$mapo.$snack.open({
|
|
256
|
+
message: error.response?.data?.detail || "Something whent bad, please try again later...",
|
|
257
|
+
color: "error"
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
},
|
|
433
262
|
},
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
263
|
+
watch: {
|
|
264
|
+
currentLang(val) {
|
|
265
|
+
// Fired when the current language changes.
|
|
266
|
+
// @arg Emits the language name as a string.
|
|
267
|
+
this.$emit("update:lang", val);
|
|
268
|
+
},
|
|
269
|
+
model(val) {
|
|
270
|
+
// Fired when the v-model changes.
|
|
271
|
+
// @arg Emits the entire payload modified.
|
|
272
|
+
this.$emit("input", val);
|
|
273
|
+
},
|
|
274
|
+
lang(val) {
|
|
275
|
+
if (val && this.langs.includes(val)) {
|
|
276
|
+
this.currentLang = val;
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
value(val) {
|
|
280
|
+
if (val) {
|
|
281
|
+
this.model = val;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
439
284
|
},
|
|
440
|
-
|
|
441
|
-
|
|
285
|
+
computed: {
|
|
286
|
+
canGoBack() {
|
|
287
|
+
if (typeof window !== "undefined") {
|
|
288
|
+
return this.$nuxt?.context?.from?.name !== "login" && window.history.length > 1 || window.history.length > 3;
|
|
289
|
+
}
|
|
290
|
+
return true;
|
|
291
|
+
},
|
|
292
|
+
crud() {
|
|
293
|
+
return this.$mapo.$api.crud(this.endpoint);
|
|
294
|
+
},
|
|
295
|
+
isReadonly() {
|
|
296
|
+
if (this.$mapo.$auth.routeMiddlewares.includes("permissions")) {
|
|
297
|
+
return !this.$mapo.$auth.user.permissions.includes(this.isNew ? "add" : "change");
|
|
298
|
+
}
|
|
299
|
+
return false;
|
|
300
|
+
},
|
|
301
|
+
canDelete() {
|
|
302
|
+
if (this.$mapo.$auth.routeMiddlewares.includes("permissions")) {
|
|
303
|
+
return this.$mapo.$auth.user.permissions.includes("delete");
|
|
304
|
+
}
|
|
305
|
+
return true;
|
|
306
|
+
},
|
|
307
|
+
mainFields() {
|
|
308
|
+
return this.fields instanceof Array ? this.fields : this.fields.main || [];
|
|
309
|
+
},
|
|
310
|
+
sideFields() {
|
|
311
|
+
return (this.fields instanceof Object && this.fields.sidenav) || [];
|
|
312
|
+
},
|
|
313
|
+
isNew() {
|
|
314
|
+
return this.identifier && this.identifier == "new";
|
|
315
|
+
},
|
|
316
|
+
loading() {
|
|
317
|
+
if (this.identifier === "new") {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
return !Object.keys(this.model).length;
|
|
321
|
+
},
|
|
322
|
+
langs() {
|
|
323
|
+
return this.modelLanguages || this.languages;
|
|
324
|
+
},
|
|
325
|
+
slotBindings() {
|
|
326
|
+
return {
|
|
327
|
+
model: this.model,
|
|
328
|
+
errors: this.errors,
|
|
329
|
+
currentLang: this.currentLang,
|
|
330
|
+
crud: this.crud,
|
|
331
|
+
isNew: this.isNew,
|
|
332
|
+
langs: this.langs,
|
|
333
|
+
loading: this.loading,
|
|
334
|
+
form: this.$refs.form,
|
|
335
|
+
saveItem: this.saveItem,
|
|
336
|
+
deleteItem: this.deleteItem
|
|
337
|
+
};
|
|
338
|
+
},
|
|
339
|
+
stickySide() {
|
|
340
|
+
return this.sticky
|
|
341
|
+
? {
|
|
342
|
+
position: "sticky",
|
|
343
|
+
top: "60px"
|
|
344
|
+
}
|
|
345
|
+
: {};
|
|
346
|
+
}
|
|
442
347
|
},
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
348
|
+
mounted() {
|
|
349
|
+
if (this.identifier && this.identifier !== "new") {
|
|
350
|
+
this.crud.detail(this.identifier).then(res => {
|
|
351
|
+
this.model = res;
|
|
352
|
+
this.modelLanguages = this.model?.lang_info?.site_languages.map(l => l.id);
|
|
353
|
+
}).catch(error => {
|
|
354
|
+
this.$nuxt.error({ statusCode: error.response.status, message: error.response.data?.detail || "Ops some error occurred.." });
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
else if (this.value) {
|
|
358
|
+
this.model = this.value;
|
|
359
|
+
this.modelLanguages = this.model?.lang_info?.site_languages.map(l => l.id);
|
|
360
|
+
}
|
|
456
361
|
},
|
|
457
|
-
stickySide() {
|
|
458
|
-
return this.sticky
|
|
459
|
-
? {
|
|
460
|
-
position: "sticky",
|
|
461
|
-
top: "60px"
|
|
462
|
-
}
|
|
463
|
-
: {};
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
|
-
mounted() {
|
|
467
|
-
if (this.identifier && this.identifier !== "new") {
|
|
468
|
-
this.crud.detail(this.identifier).then(res => {
|
|
469
|
-
this.model = res;
|
|
470
|
-
this.modelLanguages = this.model?.lang_info?.site_languages.map(l => l.id)
|
|
471
|
-
this.initLang();
|
|
472
|
-
}).catch(error => {
|
|
473
|
-
this.$nuxt.error({ statusCode: error.response.status, message: error.response.data?.detail || "Ops some error occurred.." })
|
|
474
|
-
});
|
|
475
|
-
} else if (this.value) {
|
|
476
|
-
this.model = this.value;
|
|
477
|
-
this.modelLanguages = this.model?.lang_info?.site_languages.map(l => l.id)
|
|
478
|
-
this.initLang();
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
362
|
};
|
|
482
363
|
</script>
|
|
483
364
|
|
|
@@ -522,16 +403,16 @@ Here the list of the FieldConfiguration type association.
|
|
|
522
403
|
|
|
523
404
|
- `text` ==> [v-text-field](https://vuetifyjs.com/en/components/text-fields/),
|
|
524
405
|
- `select` ==> [v-select](https://vuetifyjs.com/en/components/selects/),
|
|
525
|
-
- `date` ==> [date-field](/components/fields/DateField/),
|
|
406
|
+
- `date` ==> [date-field](/components/Form/fields/DateField/),
|
|
526
407
|
- `textarea` ==> [v-textarea](https://vuetifyjs.com/en/components/textareas/),
|
|
527
408
|
- `switch` ==> [v-switch](https://vuetifyjs.com/en/components/switches/),
|
|
528
409
|
- `slider` ==> [v-slider](https://vuetifyjs.com/en/components/sliders/),
|
|
529
|
-
- `file` ==> [file-field](/components/fields/FileField/),
|
|
530
|
-
- `editor` ==> [wyg-editor](/components/fields/wygEditor/wygEditor/),
|
|
531
|
-
- `media` ==> [media-field](/components/fields/MediaField/),
|
|
532
|
-
- `mediaList` ==> [media-m2m-field](/components/fields/MediaM2mField/)
|
|
533
|
-
- `m2m` or `fks` ==> [fks-field](/components/fields/FksField/),
|
|
534
|
-
- `repeater` ==> [repeater](/components/fields/Repeater/),
|
|
410
|
+
- `file` ==> [file-field](/components/Form/fields/FileField/),
|
|
411
|
+
- `editor` ==> [wyg-editor](/components/Form/fields/wygEditor/wygEditor/),
|
|
412
|
+
- `media` ==> [media-field](/components/Form/fields/MediaField/),
|
|
413
|
+
- `mediaList` ==> [media-m2m-field](/components/Form/fields/MediaM2mField/)
|
|
414
|
+
- `m2m` or `fks` ==> [fks-field](/components/Form/fields/FksField/),
|
|
415
|
+
- `repeater` ==> [repeater](/components/Form/fields/Repeater/),
|
|
535
416
|
|
|
536
417
|
|
|
537
418
|
#### Example of a [`FieldConfiguration`](#fieldconfiguration):
|