@mapomodule/uikit 1.0.0-alpha.10 → 1.0.0-alpha.11
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
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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.11](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2022-02-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* add lower lever errors for nested fields ([beea774](https://github.com/lotrekagency/mapo/commit/beea774e977020e4728a5c7d06b038684cb89000))
|
|
12
|
+
* fix filefield clear button ([297b8de](https://github.com/lotrekagency/mapo/commit/297b8ded8070223ef59263c7fa136843f40442af))
|
|
13
|
+
* replace model with response in detail composnent ([77d9565](https://github.com/lotrekagency/mapo/commit/77d95658332acf6f14f33921768d512dc0037c3d))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* added brand new FileField ([6928b86](https://github.com/lotrekagency/mapo/commit/6928b86aadb24503b39722d17878660b1f053c3d))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
# [1.0.0-alpha.10](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2022-02-11)
|
|
7
25
|
|
|
8
26
|
|
|
@@ -259,7 +259,7 @@ export default {
|
|
|
259
259
|
this.$refs.form?.resetValidation();
|
|
260
260
|
this.crud
|
|
261
261
|
.updateOrCreate(this.model, {}, { multipart: this.multipart })
|
|
262
|
-
.then(() => back
|
|
262
|
+
.then((resp) => { back ? this.$router.back() : this.model = resp })
|
|
263
263
|
.catch(error => {
|
|
264
264
|
this.errors =
|
|
265
265
|
(error.response.status == 400 && error.response.data) || null;
|
|
@@ -18,7 +18,7 @@ import FksField from "@mapomodule/uikit/components/fields/FksField.vue";
|
|
|
18
18
|
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
22
|
|
|
23
23
|
import { getPointed, setPointed } from "@mapomodule/utils/helpers/objHelpers";
|
|
24
24
|
import defaults from "./defaults";
|
|
@@ -35,6 +35,7 @@ export default {
|
|
|
35
35
|
MediaM2mField,
|
|
36
36
|
MediaField,
|
|
37
37
|
SeoPreview,
|
|
38
|
+
FileField,
|
|
38
39
|
},
|
|
39
40
|
|
|
40
41
|
data() {
|
|
@@ -109,9 +110,22 @@ export default {
|
|
|
109
110
|
fieldAttrs() {
|
|
110
111
|
return {
|
|
111
112
|
label: this.label,
|
|
112
|
-
errorMessages:
|
|
113
|
+
errorMessages: this.conf.value
|
|
114
|
+
.split(".")
|
|
115
|
+
.map((_, i, a) => a.slice(0, i + 1).join("."))
|
|
116
|
+
.reduce((acc, next) => {
|
|
117
|
+
const error = getPointed(this.errors || {}, next, []);
|
|
118
|
+
if (Array.isArray(error)) {
|
|
119
|
+
acc = [...acc, ...error];
|
|
120
|
+
} else if (typeof error == "string") {
|
|
121
|
+
acc = [...acc, error];
|
|
122
|
+
}
|
|
123
|
+
return acc;
|
|
124
|
+
}, []),
|
|
113
125
|
...this.defaultAttrs.All,
|
|
114
|
-
...(this.defaultAttrs[
|
|
126
|
+
...(this.defaultAttrs[
|
|
127
|
+
this.is.replace(/-./g, (x) => x[1].toUpperCase())
|
|
128
|
+
] || {}),
|
|
115
129
|
...this.conf.attrs,
|
|
116
130
|
};
|
|
117
131
|
},
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="filefield-wrapper">
|
|
3
|
+
<v-file-input
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:messages="messages"
|
|
6
|
+
:value="model"
|
|
7
|
+
@change="modelSet"
|
|
8
|
+
>
|
|
9
|
+
<template v-slot:message="{ message }">
|
|
10
|
+
<span
|
|
11
|
+
v-if="message == fileUrl"
|
|
12
|
+
v-show="message"
|
|
13
|
+
class="filefield-current"
|
|
14
|
+
><b class="mr-1">Current:</b>
|
|
15
|
+
<a :href="message" target="__blank">{{ message }}</a>
|
|
16
|
+
<v-spacer></v-spacer>
|
|
17
|
+
<v-icon @click="clear" class="mb-1" small>mdi-close</v-icon>
|
|
18
|
+
</span>
|
|
19
|
+
<span v-else>
|
|
20
|
+
{{ message }}
|
|
21
|
+
</span>
|
|
22
|
+
</template>
|
|
23
|
+
</v-file-input>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style lang="scss" scoped>
|
|
28
|
+
.filefield-current {
|
|
29
|
+
max-width: 100%;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
display: flex;
|
|
32
|
+
a {
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
/**
|
|
42
|
+
* 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.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
name: "FileField",
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
file: null,
|
|
50
|
+
fileUrl: null,
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
props: {
|
|
54
|
+
// V-model property. It is the file.
|
|
55
|
+
value: {
|
|
56
|
+
type: Object | Array | null,
|
|
57
|
+
required: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
computed: {
|
|
61
|
+
isString() {
|
|
62
|
+
return typeof this.model == "string";
|
|
63
|
+
},
|
|
64
|
+
model: {
|
|
65
|
+
get() {
|
|
66
|
+
return this.file;
|
|
67
|
+
},
|
|
68
|
+
set(val) {
|
|
69
|
+
if (!val || typeof val == "string") this.fileUrl = val;
|
|
70
|
+
if (!val || val instanceof File) this.file = val;
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
messages() {
|
|
74
|
+
const messages =
|
|
75
|
+
typeof this.$attrs.messages == "string"
|
|
76
|
+
? [this.$attrs.messages]
|
|
77
|
+
: this.$attrs.messages || [];
|
|
78
|
+
this.fileUrl &&
|
|
79
|
+
!messages.includes(this.fileUrl) &&
|
|
80
|
+
messages.push(this.fileUrl);
|
|
81
|
+
return messages;
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
watch: {
|
|
85
|
+
value(val) {
|
|
86
|
+
this.model = val;
|
|
87
|
+
},
|
|
88
|
+
model(val) {
|
|
89
|
+
this.$emit("input", val);
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
clear() {
|
|
94
|
+
this.fileUrl = null;
|
|
95
|
+
this.file = null;
|
|
96
|
+
this.model = null;
|
|
97
|
+
this.$emit("input", null);
|
|
98
|
+
},
|
|
99
|
+
modelSet(val) {
|
|
100
|
+
if (!val) {
|
|
101
|
+
this.$emit("input", this.fileUrl);
|
|
102
|
+
} else {
|
|
103
|
+
this.model = val;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/uikit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.11",
|
|
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>",
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "160b2d61a00e9cd247c8b651b403f15ba47983e8"
|
|
17
17
|
}
|