@mapomodule/uikit 1.0.0-alpha.22 → 1.0.0-alpha.25
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 +71 -0
- package/components/ConfirmDialog.vue +10 -14
- package/components/Detail/Detail.vue +23 -15
- package/components/DropArea.vue +17 -33
- package/components/Form/Form.vue +15 -11
- package/components/Form/FormField.vue +3 -0
- package/components/Form/FormGroup.vue +23 -3
- package/components/Form/FormTabs.vue +20 -3
- package/components/Form/fields/DateField.vue +3 -3
- package/components/Form/fields/FksField.vue +2 -2
- package/components/Form/fields/MediaField.vue +10 -5
- package/components/Form/fields/MediaM2mField.vue +3 -3
- package/components/Form/fields/Repeater.vue +23 -10
- package/components/Form/fields/SeoPreview.vue +10 -10
- package/components/LangSwitcher.vue +44 -0
- package/components/List/List.vue +14 -15
- package/components/List/ListActions.vue +5 -5
- package/components/List/ListFilters.vue +9 -2
- package/components/List/ListHead.vue +1 -1
- package/components/List/ListQuickEdit.vue +4 -4
- package/components/List/ListTable.vue +11 -12
- package/components/Login.vue +5 -4
- package/components/LogoutButton.vue +43 -28
- package/components/MediaManager/MediaEditor.vue +20 -18
- package/components/MediaManager/MediaFolders.vue +14 -19
- package/components/MediaManager/MediaGallery.vue +1 -1
- package/components/MediaManager/MediaManager.vue +22 -15
- package/components/MediaManager/MediaManagerDialog.vue +2 -1
- package/components/MediaManager/MediaUploader.vue +6 -7
- package/components/SnackBar.vue +2 -3
- package/components/layout/Sidebar/SidebarFooter.vue +6 -25
- package/components/layout/Sidebar/SidebarListItem.vue +2 -2
- package/components/layout/Sidebar/SidebarProfile.vue +2 -2
- package/defaults/i18n.js +37 -0
- package/{defaults.js → defaults/vuetify.js} +16 -12
- package/module.js +6 -4
- package/package.json +4 -3
- package/pages/index.vue +1 -1
- package/translations/en-US.js +129 -0
- package/translations/it-IT.js +131 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,77 @@
|
|
|
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.25](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.24...v1.0.0-alpha.25) (2022-08-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix detail field language list ([1d290e6](https://github.com/lotrekagency/mapo/commit/1d290e69c180fe31c97dfb45e2c1afcdcb569f1d))
|
|
12
|
+
* fix mediauploader typo ([67e7e4e](https://github.com/lotrekagency/mapo/commit/67e7e4e8e2214580c99331d7c21eef551edf08cc))
|
|
13
|
+
* fixed bug on preview image ([f2878ee](https://github.com/lotrekagency/mapo/commit/f2878ee5d60bc74cab49ee0c055ace22f7d37076))
|
|
14
|
+
* removed some accidental trash from previous commit ([4a85da4](https://github.com/lotrekagency/mapo/commit/4a85da419bddaadfe6a08afa5f71fe5e76e346f7))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **i18n:** move i18n config to mapo defaults to enable mixed merges of user and mapo options. ([2190aa9](https://github.com/lotrekagency/mapo/commit/2190aa9ebf106d811a64e27502d3a45b75a3e9af))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [1.0.0-alpha.24](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.23...v1.0.0-alpha.24) (2022-07-22)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **i18n:** use iso code for vuetify language code ([0683c78](https://github.com/lotrekagency/mapo/commit/0683c78ecf3f3e196b0fb6e7c8d007e20f12bf62))
|
|
31
|
+
* fixed login screen ([f925672](https://github.com/lotrekagency/mapo/commit/f92567288c07ae6162bfc14f2ac220aff193ad5f))
|
|
32
|
+
* **list:** pass selectionQuery to list actions ([7385daa](https://github.com/lotrekagency/mapo/commit/7385daaf6ef727123c966dec3747c1c18c54f73a))
|
|
33
|
+
* **listfilters:** added watch on list filters ([753f40e](https://github.com/lotrekagency/mapo/commit/753f40e7776935bc0f3e499c573868d5e7e0502d))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* **i18:** handle i18n on images' alt title tags ([3fb3f62](https://github.com/lotrekagency/mapo/commit/3fb3f62ae045b6610c881f90e31f0b5a242ce46b))
|
|
39
|
+
* **i18n:** handle translations on meta router ([2e20afe](https://github.com/lotrekagency/mapo/commit/2e20afedd34b42adb7d9cc53235a7e469ae67e9d))
|
|
40
|
+
* added language switcher ([6995542](https://github.com/lotrekagency/mapo/commit/6995542228acc8c603d28b29edf1abee02f23404))
|
|
41
|
+
* refactored translations, added vuetify translations ([bd37682](https://github.com/lotrekagency/mapo/commit/bd376820ad05a00f49088b9585b7bb26371e09f8))
|
|
42
|
+
* **form:** added vShow on tabs and groups ([631e43f](https://github.com/lotrekagency/mapo/commit/631e43f10c7614e87a393a688fa1339092ef0cb7))
|
|
43
|
+
* **i18n:** i18n for detail and form fields ([74760b1](https://github.com/lotrekagency/mapo/commit/74760b1c72314df34f3bb7e5dbaf95037d9c40fe))
|
|
44
|
+
* **i18n:** i18n on sidebar and list components ([64fb9a1](https://github.com/lotrekagency/mapo/commit/64fb9a152836b5620f52b1a448dc00ecafcd9ea3))
|
|
45
|
+
* **i18n:** setup on generic and media components ([f38588f](https://github.com/lotrekagency/mapo/commit/f38588f56aedbf9466af5c40296e35bf2765d036))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# [1.0.0-alpha.23](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.22...v1.0.0-alpha.23) (2022-05-04)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Bug Fixes
|
|
55
|
+
|
|
56
|
+
* **detail:** prevent rendering of fields until the model is fully loaded ([0421d79](https://github.com/lotrekagency/mapo/commit/0421d79ea1a1e15b37a5addfd7eebd0c83b23a96))
|
|
57
|
+
* **repeater:** better borders and padding for repeater lines ([07faf36](https://github.com/lotrekagency/mapo/commit/07faf36ac8d46c290cf12be41948f21a693e3da7))
|
|
58
|
+
* **seoPreview:** fix permalink preview to integrate the domain ([8bdd6a3](https://github.com/lotrekagency/mapo/commit/8bdd6a35ce9643206121d531ca07d083fe20c5b5))
|
|
59
|
+
* fix detail component not redirecting on save and continue action ([3ba4bb6](https://github.com/lotrekagency/mapo/commit/3ba4bb6457242e583ca43f42db070bde731b6c26))
|
|
60
|
+
* fix readonly fields in forms ([564a853](https://github.com/lotrekagency/mapo/commit/564a853f2c4d572cdb340d52b9801ad6d7f053d0))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Features
|
|
64
|
+
|
|
65
|
+
* **forms:** update style of group and tabs ([a8d902b](https://github.com/lotrekagency/mapo/commit/a8d902b2b586563d765316cb5912d26df8144eae))
|
|
66
|
+
* added maxHeight prop to repeater ([5adc02e](https://github.com/lotrekagency/mapo/commit/5adc02efb07d2ca61f7265ec1c4d0377cdb76837))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Performance Improvements
|
|
70
|
+
|
|
71
|
+
* **forms:** Decrease rendering time of form component, and all Components based on form ([22a191a](https://github.com/lotrekagency/mapo/commit/22a191a2f791a8dfe93336e53aec7cfbe3baa1f5))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
6
77
|
# [1.0.0-alpha.22](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2022-05-01)
|
|
7
78
|
|
|
8
79
|
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
</v-dialog>
|
|
16
16
|
</div>
|
|
17
17
|
</template>
|
|
18
|
-
<script>
|
|
19
18
|
|
|
19
|
+
<script>
|
|
20
20
|
/**
|
|
21
|
-
* This component is embedded in the default layout.
|
|
21
|
+
* This component is embedded in the default layout.
|
|
22
22
|
* It's a dynamic dialog which is used to ask the user for confirmation before performing an operation.<br>
|
|
23
23
|
* For example: `Do you really want to delete the content 'abcd'?` <br><br>
|
|
24
24
|
* It can be globally accessed with [this.$mapo.$confirm](/core/#confirm)
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
27
|
export default {
|
|
28
28
|
name: "ConfirmDialog",
|
|
29
29
|
data() {
|
|
@@ -32,10 +32,10 @@ export default {
|
|
|
32
32
|
dialog: false,
|
|
33
33
|
optionsBk: null,
|
|
34
34
|
options: {
|
|
35
|
-
title: this.title,
|
|
36
|
-
question: this.question,
|
|
37
|
-
dismissButton: this.dismissButton,
|
|
38
|
-
approveButton: this.approveButton,
|
|
35
|
+
title: this.title || this.$t("mapo.confirm"),
|
|
36
|
+
question: this.question || this.$t("mapo.confirmDialog.areYouSure"),
|
|
37
|
+
dismissButton: this.dismissButton || { text: this.$t("mapo.cancel"), attrs: { text: true } },
|
|
38
|
+
approveButton: this.approveButton || { text: this.$t("mapo.ok"), attrs: { color: "primary", text: true } },
|
|
39
39
|
attrs: { ...this.$attrs }
|
|
40
40
|
},
|
|
41
41
|
on: {
|
|
@@ -56,35 +56,31 @@ export default {
|
|
|
56
56
|
// The text in the body of the dialog.
|
|
57
57
|
question: {
|
|
58
58
|
type: String,
|
|
59
|
-
default: "Are you sure of what you are doing?"
|
|
60
59
|
},
|
|
61
60
|
// The title of the dialog.
|
|
62
61
|
title: {
|
|
63
62
|
type: String,
|
|
64
|
-
default: "Confirm"
|
|
65
63
|
},
|
|
66
64
|
// The text plus props passed to the dismiss Button.
|
|
67
65
|
dismissButton: {
|
|
68
66
|
// `{ text: String, attrs: Object }`
|
|
69
67
|
type: Object,
|
|
70
|
-
default: () => ({ text: "Cancel", attrs: { text: true } })
|
|
71
68
|
},
|
|
72
69
|
// The text plus props passed to the approve Button.
|
|
73
70
|
approveButton: {
|
|
74
71
|
// `{ text: String, attrs: Object }`
|
|
75
72
|
type: Object,
|
|
76
|
-
default: () => ({ text: "Ok", attrs: { color: "primary", text: true } })
|
|
77
73
|
}
|
|
78
74
|
},
|
|
79
75
|
computed: {
|
|
80
76
|
approveTxt() {
|
|
81
|
-
return this.options.approveButton?.text || "
|
|
77
|
+
return this.options.approveButton?.text || this.$t("mapo.ok");
|
|
82
78
|
},
|
|
83
79
|
approveAttrs() {
|
|
84
80
|
return this.options.approveButton?.attrs || {};
|
|
85
81
|
},
|
|
86
82
|
dismissTxt() {
|
|
87
|
-
return this.options.dismissButton?.text || "
|
|
83
|
+
return this.options.dismissButton?.text || this.$t("mapo.cancel");
|
|
88
84
|
},
|
|
89
85
|
dismissAttrs() {
|
|
90
86
|
return this.options.dismissButton?.attrs || {};
|
|
@@ -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
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
></v-progress-linear>
|
|
10
10
|
<span class="detail-component-loading ">
|
|
11
11
|
<v-icon size="30">mdi-timer-sand</v-icon>
|
|
12
|
-
|
|
12
|
+
{{ $t('mapo.fetchingData') }}
|
|
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>` -->
|
|
19
19
|
<v-row class="mb-5">
|
|
20
|
-
<v-col col="12"><h1 class="display-1">{{ isNew ? "
|
|
20
|
+
<v-col col="12"><h1 class="display-1">{{ isNew ? $t("mapo.create") : $t("mapo.edit") }} {{ modelName }}</h1></v-col>
|
|
21
21
|
</v-row>
|
|
22
22
|
</slot>
|
|
23
23
|
<v-form ref="form">
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
:errors="errors"
|
|
48
48
|
:fields="mainFields"
|
|
49
49
|
:moreSlotBindings="slotBindings"
|
|
50
|
+
:readonly="isReadonly"
|
|
50
51
|
>
|
|
51
52
|
<template v-for="(_, slot) in $slots" :slot="slot">
|
|
52
53
|
<!-- @vuese-ignore -->
|
|
@@ -73,21 +74,21 @@
|
|
|
73
74
|
<slot name="button.save" v-bind="slotBindings">
|
|
74
75
|
<!-- The Save button. -->
|
|
75
76
|
<v-btn v-show="canGoBack" :disabled="isReadonly" class="mb-2" tile block @click="saveItem(true)">{{
|
|
76
|
-
isNew ? "
|
|
77
|
+
isNew ? $t("mapo.create") : $t("mapo.save")
|
|
77
78
|
}}</v-btn>
|
|
78
79
|
</slot>
|
|
79
80
|
<!-- Use this to override the Save and continue button. -->
|
|
80
81
|
<slot name="button.savecontinue" v-bind="slotBindings">
|
|
81
82
|
<!-- The Save and continue button. -->
|
|
82
83
|
<v-btn :disabled="isReadonly" class="mb-2" tile block @click="saveItem(false)"
|
|
83
|
-
>{{ isNew ? "
|
|
84
|
+
>{{ isNew ? $t("mapo.createContinue") : $t("mapo.saveContinue") }}</v-btn
|
|
84
85
|
>
|
|
85
86
|
</slot>
|
|
86
87
|
<!-- Use this to override the Back button. -->
|
|
87
88
|
<slot name="button.back" v-bind="slotBindings">
|
|
88
89
|
<!-- The Back button. -->
|
|
89
90
|
<v-btn v-show="canGoBack" class="mb-2" tile block @click="back"
|
|
90
|
-
>
|
|
91
|
+
>{{ $t("mapo.back") }}</v-btn
|
|
91
92
|
>
|
|
92
93
|
</slot>
|
|
93
94
|
<!-- Use this to override the Delete button. -->
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
block
|
|
102
103
|
:disabled="!canDelete"
|
|
103
104
|
@click="deleteItem"
|
|
104
|
-
>
|
|
105
|
+
>{{ $t("mapo.delete") }}</v-btn
|
|
105
106
|
>
|
|
106
107
|
</slot>
|
|
107
108
|
</div>
|
|
@@ -222,12 +223,19 @@ export default {
|
|
|
222
223
|
this.$refs.form?.resetValidation();
|
|
223
224
|
this.crud
|
|
224
225
|
.updateOrCreate(this.model, {}, { multipart: this.multipart })
|
|
225
|
-
.then((resp) => {
|
|
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
|
+
}
|
|
233
|
+
})
|
|
226
234
|
.catch(error => {
|
|
227
235
|
this.errors =
|
|
228
236
|
(error.response.status == 400 && error.response.data) || null;
|
|
229
237
|
this.$mapo.$snack.open({
|
|
230
|
-
message: error.response?.data?.detail || "
|
|
238
|
+
message: error.response?.data?.detail || this.$t("mapo.genericError"),
|
|
231
239
|
color: "error"
|
|
232
240
|
});
|
|
233
241
|
});
|
|
@@ -236,8 +244,8 @@ export default {
|
|
|
236
244
|
this.$mapo.$confirm
|
|
237
245
|
.open({
|
|
238
246
|
title: "Delete",
|
|
239
|
-
question:
|
|
240
|
-
approveButton: { text: "
|
|
247
|
+
question: this.$t("mapo.confirmDelete"),
|
|
248
|
+
approveButton: { text: this.$t("mapo.delete"), attrs: { color: "red", text: true } }
|
|
241
249
|
})
|
|
242
250
|
.then(res => {
|
|
243
251
|
if (res) {
|
|
@@ -245,7 +253,7 @@ export default {
|
|
|
245
253
|
.delete(this.identifier)
|
|
246
254
|
.then(() => this.back())
|
|
247
255
|
.catch(error => this.$mapo.$snack.open({
|
|
248
|
-
message: error.response?.data?.detail || "
|
|
256
|
+
message: error.response?.data?.detail || this.$t("mapo.genericError"),
|
|
249
257
|
color: "error"
|
|
250
258
|
}));
|
|
251
259
|
}
|
|
@@ -312,7 +320,7 @@ export default {
|
|
|
312
320
|
return !Object.keys(this.model).length;
|
|
313
321
|
},
|
|
314
322
|
langs() {
|
|
315
|
-
return this.modelLanguages || this.languages;
|
|
323
|
+
return (this.modelLanguages || []).length ? this.modelLanguages : this.languages;
|
|
316
324
|
},
|
|
317
325
|
slotBindings() {
|
|
318
326
|
return {
|
|
@@ -343,7 +351,7 @@ export default {
|
|
|
343
351
|
this.model = res;
|
|
344
352
|
this.modelLanguages = this.model?.lang_info?.site_languages.map(l => l.id);
|
|
345
353
|
}).catch(error => {
|
|
346
|
-
this.$nuxt.error({ statusCode: error.response.status, message: error.response.data?.detail || "
|
|
354
|
+
this.$nuxt.error({ statusCode: error.response.status, message: error.response.data?.detail || this.$t("mapo.genericError") });
|
|
347
355
|
});
|
|
348
356
|
}
|
|
349
357
|
else if (this.value) {
|
package/components/DropArea.vue
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<v-icon :class="[dragover ? 'mt-2, mb-6' : 'mt-5']" size="60">
|
|
20
20
|
mdi-cloud-upload
|
|
21
21
|
</v-icon>
|
|
22
|
-
<p>
|
|
22
|
+
<p>{{ $t("mapo.dropArea.dropOrClick") }}</p>
|
|
23
23
|
<input
|
|
24
24
|
type="file"
|
|
25
25
|
style="display: none"
|
|
@@ -30,9 +30,7 @@
|
|
|
30
30
|
</v-row>
|
|
31
31
|
<v-virtual-scroll
|
|
32
32
|
:items="uploadedFiles"
|
|
33
|
-
:height="
|
|
34
|
-
uploadedFiles.length * 64 > 256 ? 256 : uploadedFiles.length * 64
|
|
35
|
-
"
|
|
33
|
+
:height="uploadedFiles.length * 64 > 256 ? 256 : uploadedFiles.length * 64"
|
|
36
34
|
item-height="64"
|
|
37
35
|
>
|
|
38
36
|
<template v-slot:default="{ item }">
|
|
@@ -41,10 +39,7 @@
|
|
|
41
39
|
<v-img :src="item.info.objectURL"></v-img>
|
|
42
40
|
</v-list-item-avatar>
|
|
43
41
|
|
|
44
|
-
<v-list-item-content
|
|
45
|
-
class="cursor-pointer"
|
|
46
|
-
@click.stop="editItem(item)"
|
|
47
|
-
>
|
|
42
|
+
<v-list-item-content class="cursor-pointer" @click.stop="editItem(item)">
|
|
48
43
|
<v-list-item-title>
|
|
49
44
|
{{ item.info.name }}
|
|
50
45
|
</v-list-item-title>
|
|
@@ -74,11 +69,7 @@
|
|
|
74
69
|
</v-btn>
|
|
75
70
|
</slot>
|
|
76
71
|
</v-card-actions>
|
|
77
|
-
<v-dialog
|
|
78
|
-
v-model="editDialog"
|
|
79
|
-
v-bind="{ light, dark, elevation }"
|
|
80
|
-
max-width="500px"
|
|
81
|
-
>
|
|
72
|
+
<v-dialog v-model="editDialog" v-bind="{ light, dark, elevation }" max-width="500px">
|
|
82
73
|
<v-card v-if="editedItem">
|
|
83
74
|
<v-card-title>
|
|
84
75
|
<!-- Slot to provide custom edit card title. Exposes `editedItem`. -->
|
|
@@ -102,7 +93,7 @@
|
|
|
102
93
|
<v-col cols="12">
|
|
103
94
|
<v-text-field
|
|
104
95
|
v-model="editedItem.name"
|
|
105
|
-
label="
|
|
96
|
+
:label="$t('mapo.fileName')"
|
|
106
97
|
></v-text-field>
|
|
107
98
|
</v-col>
|
|
108
99
|
</v-row>
|
|
@@ -112,8 +103,8 @@
|
|
|
112
103
|
|
|
113
104
|
<v-card-actions>
|
|
114
105
|
<v-spacer></v-spacer>
|
|
115
|
-
<v-btn color="primary" text @click="closeEdit">
|
|
116
|
-
<v-btn color="primary" text @click="saveEdit">
|
|
106
|
+
<v-btn color="primary" text @click="closeEdit">{{ $t("mapo.cancel") }}</v-btn>
|
|
107
|
+
<v-btn color="primary" text @click="saveEdit">{{ $t("mapo.save") }}</v-btn>
|
|
117
108
|
</v-card-actions>
|
|
118
109
|
</v-card>
|
|
119
110
|
</v-dialog>
|
|
@@ -133,8 +124,8 @@ import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
|
|
|
133
124
|
* You can drag and drop over the button or click it to load the files.
|
|
134
125
|
* When files are loaded into the component it will emit an event containing all the files.
|
|
135
126
|
* This component will not take care of the actual file upload.
|
|
136
|
-
*
|
|
137
|
-
*/
|
|
127
|
+
*
|
|
128
|
+
*/
|
|
138
129
|
export default {
|
|
139
130
|
name: "DropArea",
|
|
140
131
|
props: {
|
|
@@ -174,9 +165,7 @@ export default {
|
|
|
174
165
|
this.uploadedFiles = [];
|
|
175
166
|
},
|
|
176
167
|
removeFile(fileName) {
|
|
177
|
-
const index = this.uploadedFiles.findIndex(
|
|
178
|
-
(file) => file.info.name === fileName
|
|
179
|
-
);
|
|
168
|
+
const index = this.uploadedFiles.findIndex((file) => file.info.name === fileName);
|
|
180
169
|
if (index > -1) this.uploadedFiles.splice(index, 1);
|
|
181
170
|
},
|
|
182
171
|
pickFile() {
|
|
@@ -193,7 +182,7 @@ export default {
|
|
|
193
182
|
if (this.uploadedFiles.length > 0) this.uploadedFiles = [];
|
|
194
183
|
if (!this.multiple && files.length > 1) {
|
|
195
184
|
this.$mapo.$snack.open({
|
|
196
|
-
message: "
|
|
185
|
+
message: this.$t("mapo.dropArea.onlyOneFile"),
|
|
197
186
|
color: "error",
|
|
198
187
|
});
|
|
199
188
|
} else {
|
|
@@ -207,9 +196,7 @@ export default {
|
|
|
207
196
|
processFile(blob) {
|
|
208
197
|
return {
|
|
209
198
|
info: {
|
|
210
|
-
objectURL: blob.type.startsWith("image/")
|
|
211
|
-
? URL.createObjectURL(blob)
|
|
212
|
-
: null,
|
|
199
|
+
objectURL: blob.type.startsWith("image/") ? URL.createObjectURL(blob) : null,
|
|
213
200
|
name: blob.name,
|
|
214
201
|
size: humanFileSize(blob.size, true, 2),
|
|
215
202
|
type: blob.type,
|
|
@@ -223,10 +210,7 @@ export default {
|
|
|
223
210
|
this.editDialog = true;
|
|
224
211
|
},
|
|
225
212
|
saveEdit() {
|
|
226
|
-
this.uploadedFiles[this.editedIndex].info = Object.assign(
|
|
227
|
-
{},
|
|
228
|
-
this.editedItem
|
|
229
|
-
);
|
|
213
|
+
this.uploadedFiles[this.editedIndex].info = Object.assign({}, this.editedItem);
|
|
230
214
|
this.closeEdit();
|
|
231
215
|
},
|
|
232
216
|
closeEdit() {
|
|
@@ -240,11 +224,11 @@ export default {
|
|
|
240
224
|
watch: {
|
|
241
225
|
uploadedFiles(val) {
|
|
242
226
|
/** Fires when the list of files loaded changes
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
227
|
+
* @arg This emits a list of files in the format {info, blob} where the blob is a
|
|
228
|
+
* [File](https://developer.mozilla.org/en-US/docs/Web/API/File) and info are some custom info about the file.
|
|
229
|
+
*/
|
|
246
230
|
this.$emit("change", val);
|
|
247
231
|
},
|
|
248
232
|
},
|
|
249
233
|
};
|
|
250
|
-
</script>
|
|
234
|
+
</script>
|
package/components/Form/Form.vue
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<FormTabs
|
|
12
12
|
v-if="field.tabs"
|
|
13
13
|
v-model="model"
|
|
14
|
-
v-bind="{ currentLang, errors, languages }"
|
|
14
|
+
v-bind="{ currentLang, errors, languages, readonly }"
|
|
15
15
|
:conf="field"
|
|
16
16
|
:moreSlotBindings="slotBindings"
|
|
17
17
|
>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<FormGroup
|
|
32
32
|
v-else-if="field.group"
|
|
33
33
|
v-model="model"
|
|
34
|
-
v-bind="{ currentLang, errors, languages }"
|
|
34
|
+
v-bind="{ currentLang, errors, languages, readonly }"
|
|
35
35
|
:conf="field"
|
|
36
36
|
:moreSlotBindings="slotBindings"
|
|
37
37
|
>
|
|
@@ -57,10 +57,9 @@
|
|
|
57
57
|
>
|
|
58
58
|
<FormField
|
|
59
59
|
v-model="model"
|
|
60
|
+
v-bind="{ currentLang, errors, readonly }"
|
|
60
61
|
:langs="languages"
|
|
61
|
-
:currentLang="currentLang"
|
|
62
62
|
:conf="field"
|
|
63
|
-
:errors="errors"
|
|
64
63
|
>
|
|
65
64
|
<template
|
|
66
65
|
v-for="slot in nameSpacedSlots($slots, `fields.${field.value}.`)"
|
|
@@ -84,13 +83,14 @@
|
|
|
84
83
|
<script>
|
|
85
84
|
import { nameSpacedSlots } from "@mapomodule/utils/helpers/slots";
|
|
86
85
|
import { slugify, titleCase } from "@mapomodule/utils/helpers/formatters";
|
|
87
|
-
import {
|
|
86
|
+
import { deepClone } from "@mapomodule/utils/helpers/objHelpers";
|
|
88
87
|
|
|
89
88
|
export default {
|
|
90
89
|
name: "Form",
|
|
91
90
|
data() {
|
|
92
91
|
return {
|
|
93
92
|
model: {},
|
|
93
|
+
internalFields: []
|
|
94
94
|
};
|
|
95
95
|
},
|
|
96
96
|
props: {
|
|
@@ -104,6 +104,8 @@ export default {
|
|
|
104
104
|
type: String,
|
|
105
105
|
required: false,
|
|
106
106
|
},
|
|
107
|
+
// Makes all the fields readonly.
|
|
108
|
+
readonly: Boolean,
|
|
107
109
|
// An object representing all the errors of all fields. This means that this component will find the error of its field following the dottedPath of the value in the error dict.
|
|
108
110
|
errors: Object,
|
|
109
111
|
// Additional bindings to indrease slots capabilities
|
|
@@ -128,6 +130,9 @@ export default {
|
|
|
128
130
|
model(val) {
|
|
129
131
|
this.$emit("input", val);
|
|
130
132
|
},
|
|
133
|
+
fields(val){
|
|
134
|
+
this.internalFields = this.cloneFields(val)
|
|
135
|
+
}
|
|
131
136
|
},
|
|
132
137
|
methods: {
|
|
133
138
|
nameSpacedSlots,
|
|
@@ -175,11 +180,6 @@ export default {
|
|
|
175
180
|
return this.parseGroup(gType == "string" ? { ...this.parseGroup(field.group, null), slug} : { slug,...field.group }, null)
|
|
176
181
|
},
|
|
177
182
|
mapConf(fields) {
|
|
178
|
-
////// This is an hack to prevent render loop
|
|
179
|
-
const functions = findPropPaths(fields, ({ val }) => typeof val == "function" ).reduce((acc, key) => ({[key]: getPointed(fields, key, undefined) , ...acc}), {})
|
|
180
|
-
fields = JSON.parse(JSON.stringify(fields))
|
|
181
|
-
Object.keys(functions).forEach(key => setPointed(fields, key, functions[key]))
|
|
182
|
-
//// End of hack ====> TODO: find a better way to avoid loops
|
|
183
183
|
return fields.map((f, i) =>
|
|
184
184
|
f.tabs
|
|
185
185
|
? { group: this.parseTagsGroup(f), tabs: this.parseTabs(f.tabs) }
|
|
@@ -199,6 +199,9 @@ export default {
|
|
|
199
199
|
})
|
|
200
200
|
}
|
|
201
201
|
return true
|
|
202
|
+
},
|
|
203
|
+
cloneFields(fields){
|
|
204
|
+
return process.browser ? deepClone(fields) : fields
|
|
202
205
|
}
|
|
203
206
|
|
|
204
207
|
},
|
|
@@ -213,10 +216,11 @@ export default {
|
|
|
213
216
|
};
|
|
214
217
|
},
|
|
215
218
|
computedFields() {
|
|
216
|
-
return this.mapConf(this.
|
|
219
|
+
return this.mapConf(this.internalFields);
|
|
217
220
|
},
|
|
218
221
|
},
|
|
219
222
|
created(){
|
|
223
|
+
this.internalFields = this.cloneFields(this.fields)
|
|
220
224
|
this.model = this.value
|
|
221
225
|
this.initLang();
|
|
222
226
|
}
|
|
@@ -65,6 +65,8 @@ export default {
|
|
|
65
65
|
type: Object,
|
|
66
66
|
required: true,
|
|
67
67
|
},
|
|
68
|
+
// Makes the field readonly.
|
|
69
|
+
readonly: Boolean,
|
|
68
70
|
// An object representing all the errors of all fields. This means that this component will find the error of its field following the dottedPath of the value in the error dict.
|
|
69
71
|
errors: Object,
|
|
70
72
|
// The main configuration that determines the rendering of the field. See [FieldConfiguration](/components/detail/Detail/#fieldconfiguration).
|
|
@@ -153,6 +155,7 @@ export default {
|
|
|
153
155
|
...(this.defaultAttrs[
|
|
154
156
|
this.is.replace(/-./g, (x) => x[1].toUpperCase())
|
|
155
157
|
] || {}),
|
|
158
|
+
readonly: this.readonly,
|
|
156
159
|
...this.conf.attrs,
|
|
157
160
|
currentLang: this.currentLang,
|
|
158
161
|
langs: this.langs,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-card v-if="conf" class="my-2 rounded-0">
|
|
2
|
+
<v-card v-if="conf" v-show="show(conf.group)" class="my-2 rounded-0 elevation-0 group-card">
|
|
3
3
|
<v-card-title :class="conf.group.titleClass">
|
|
4
4
|
<slot name="title.before" v-bind="slotBindings" />
|
|
5
5
|
<slot name="title" v-bind="slotBindings">
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<div class="container">
|
|
12
12
|
<Form
|
|
13
13
|
v-model="model"
|
|
14
|
-
v-bind="{ currentLang, errors, languages }"
|
|
14
|
+
v-bind="{ currentLang, errors, languages, readonly }"
|
|
15
15
|
:fields="conf.fields"
|
|
16
16
|
:moreSlotBindings="slotBindings"
|
|
17
17
|
>
|
|
@@ -27,7 +27,11 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
</v-card>
|
|
29
29
|
</template>
|
|
30
|
-
|
|
30
|
+
<style lang="scss" scoped>
|
|
31
|
+
.theme--light .group-card {
|
|
32
|
+
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
31
35
|
<script>
|
|
32
36
|
export default {
|
|
33
37
|
name: "FormGroup",
|
|
@@ -61,6 +65,8 @@ export default {
|
|
|
61
65
|
type: Array,
|
|
62
66
|
default: () => [],
|
|
63
67
|
},
|
|
68
|
+
// Makes all the fields readonly.
|
|
69
|
+
readonly: Boolean,
|
|
64
70
|
},
|
|
65
71
|
watch: {
|
|
66
72
|
value(val) {
|
|
@@ -81,6 +87,20 @@ export default {
|
|
|
81
87
|
};
|
|
82
88
|
},
|
|
83
89
|
},
|
|
90
|
+
methods: {
|
|
91
|
+
show(conf, type = "display"){
|
|
92
|
+
const prop = type == "visibility" ? "vVisible" : "vShow"
|
|
93
|
+
if (typeof conf[prop] == "function") {
|
|
94
|
+
return conf[prop]({
|
|
95
|
+
model: this.model,
|
|
96
|
+
errors: this.errors,
|
|
97
|
+
languages: this.languages,
|
|
98
|
+
currentLang: this.currentLang
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
return true
|
|
102
|
+
},
|
|
103
|
+
},
|
|
84
104
|
created() {
|
|
85
105
|
this.model = this.value;
|
|
86
106
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-card v-if="conf" class="my-2 rounded-0">
|
|
2
|
+
<v-card v-if="conf" class="tabs-card my-2 rounded-0 elevation-0">
|
|
3
3
|
<v-card-title :class="conf.group.titleClass" v-if="hasTitle">
|
|
4
4
|
<slot name="title.before" v-bind="slotBindings" />
|
|
5
5
|
<slot name="title" v-bind="slotBindings">
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</v-card-title>
|
|
11
11
|
<div class="container">
|
|
12
12
|
<v-tabs v-model="tabIndex" class="tab-wrapper">
|
|
13
|
-
<v-tab v-for="(tab, index) in conf.tabs" :key="index">
|
|
13
|
+
<v-tab v-for="(tab, index) in conf.tabs" :key="index" v-show="show(tab)">
|
|
14
14
|
<v-badge :value="hasErrors(tab)" color="error" dot>
|
|
15
15
|
{{ tab.label }} <v-icon v-if="tab.icon">{{ tab.icon }}</v-icon>
|
|
16
16
|
</v-badge>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<slot :name="`tab.${tab.slug}`" v-bind="slotBindings">
|
|
22
22
|
<Form
|
|
23
23
|
v-model="model"
|
|
24
|
-
v-bind="{ currentLang, errors, languages }"
|
|
24
|
+
v-bind="{ currentLang, errors, languages, readonly }"
|
|
25
25
|
:fields="tab.fields"
|
|
26
26
|
:moreSlotBindings="slotBindings"
|
|
27
27
|
>
|
|
@@ -52,6 +52,9 @@
|
|
|
52
52
|
.tab-wrapper {
|
|
53
53
|
margin: -12px 0 0 -12px;
|
|
54
54
|
}
|
|
55
|
+
.theme--light .tabs-card {
|
|
56
|
+
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
57
|
+
}
|
|
55
58
|
</style>
|
|
56
59
|
<script>
|
|
57
60
|
import { findPropPaths } from "@mapomodule/utils/helpers/objHelpers";
|
|
@@ -76,6 +79,8 @@ export default {
|
|
|
76
79
|
type: String,
|
|
77
80
|
required: false,
|
|
78
81
|
},
|
|
82
|
+
// Makes all the fields readonly.
|
|
83
|
+
readonly: Boolean,
|
|
79
84
|
// An object representing all the errors of all fields. This means that this component will find the error of its field following the dottedPath of the value in the error dict.
|
|
80
85
|
errors: Object,
|
|
81
86
|
// Additional bindings to indrease slots capabilities
|
|
@@ -126,6 +131,18 @@ export default {
|
|
|
126
131
|
Array.isArray(val)
|
|
127
132
|
).some((k) => tab.fields.some((f) => k.startsWith(f.value)));
|
|
128
133
|
},
|
|
134
|
+
show(conf, type = "display"){
|
|
135
|
+
const prop = type == "visibility" ? "vVisible" : "vShow"
|
|
136
|
+
if (typeof conf[prop] == "function") {
|
|
137
|
+
return conf[prop]({
|
|
138
|
+
model: this.model,
|
|
139
|
+
errors: this.errors,
|
|
140
|
+
languages: this.languages,
|
|
141
|
+
currentLang: this.currentLang
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
return true
|
|
145
|
+
},
|
|
129
146
|
},
|
|
130
147
|
created() {
|
|
131
148
|
this.model = this.value;
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
></v-text-field>
|
|
22
22
|
</template>
|
|
23
23
|
<v-date-picker v-model="model" :range="range" no-title>
|
|
24
|
-
<v-btn text color="primary" @click="menu = false">
|
|
25
|
-
<v-btn text color="primary" @click="$refs.menu.save(model)">
|
|
24
|
+
<v-btn text color="primary" @click="menu = false">{{ $t("mapo.cancel") }}</v-btn>
|
|
25
|
+
<v-btn text color="primary" @click="$refs.menu.save(model)">{{ $t("mapo.ok") }}</v-btn>
|
|
26
26
|
</v-date-picker>
|
|
27
27
|
</v-menu>
|
|
28
28
|
</div>
|
|
@@ -71,4 +71,4 @@ export default {
|
|
|
71
71
|
this.model = this.value;
|
|
72
72
|
},
|
|
73
73
|
};
|
|
74
|
-
</script>
|
|
74
|
+
</script>
|