@mapomodule/uikit 1.0.0-alpha.22 → 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 +26 -0
- package/components/Detail/Detail.vue +11 -3
- package/components/Form/Form.vue +15 -11
- package/components/Form/FormField.vue +3 -0
- package/components/Form/FormGroup.vue +9 -3
- package/components/Form/FormTabs.vue +7 -2
- package/components/Form/fields/Repeater.vue +17 -4
- package/components/Form/fields/SeoPreview.vue +6 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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.23](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.22...v1.0.0-alpha.23) (2022-05-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **detail:** prevent rendering of fields until the model is fully loaded ([0421d79](https://github.com/lotrekagency/mapo/commit/0421d79ea1a1e15b37a5addfd7eebd0c83b23a96))
|
|
12
|
+
* **repeater:** better borders and padding for repeater lines ([07faf36](https://github.com/lotrekagency/mapo/commit/07faf36ac8d46c290cf12be41948f21a693e3da7))
|
|
13
|
+
* **seoPreview:** fix permalink preview to integrate the domain ([8bdd6a3](https://github.com/lotrekagency/mapo/commit/8bdd6a35ce9643206121d531ca07d083fe20c5b5))
|
|
14
|
+
* fix detail component not redirecting on save and continue action ([3ba4bb6](https://github.com/lotrekagency/mapo/commit/3ba4bb6457242e583ca43f42db070bde731b6c26))
|
|
15
|
+
* fix readonly fields in forms ([564a853](https://github.com/lotrekagency/mapo/commit/564a853f2c4d572cdb340d52b9801ad6d7f053d0))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **forms:** update style of group and tabs ([a8d902b](https://github.com/lotrekagency/mapo/commit/a8d902b2b586563d765316cb5912d26df8144eae))
|
|
21
|
+
* added maxHeight prop to repeater ([5adc02e](https://github.com/lotrekagency/mapo/commit/5adc02efb07d2ca61f7265ec1c4d0377cdb76837))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Performance Improvements
|
|
25
|
+
|
|
26
|
+
* **forms:** Decrease rendering time of form component, and all Components based on form ([22a191a](https://github.com/lotrekagency/mapo/commit/22a191a2f791a8dfe93336e53aec7cfbe3baa1f5))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
6
32
|
# [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
33
|
|
|
8
34
|
|
|
@@ -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>` -->
|
|
@@ -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 -->
|
|
@@ -222,7 +223,14 @@ 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;
|
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" 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) {
|
|
@@ -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">
|
|
@@ -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
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
>Collapse all</v-btn
|
|
7
7
|
>
|
|
8
8
|
</div>
|
|
9
|
-
<v-divider />
|
|
10
9
|
<draggable
|
|
11
10
|
v-model="items"
|
|
12
11
|
handle=".repeater-handle-sort"
|
|
13
12
|
animation="150"
|
|
14
13
|
@change="sortCallback({ ...$event, items, eventType: 'move' })"
|
|
14
|
+
:style="maxHeightStyle"
|
|
15
15
|
>
|
|
16
16
|
<div
|
|
17
17
|
class="repeater-line-wrapper"
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
:key="index"
|
|
21
21
|
>
|
|
22
22
|
<div class="d-flex">
|
|
23
|
-
<v-divider vertical />
|
|
24
23
|
<div v-if="collapsable" class="collapsed-preview">
|
|
25
24
|
<v-icon class="expand-icon" @click.native="toggleExpand($event)"
|
|
26
25
|
>mdi-chevron-down</v-icon
|
|
@@ -38,6 +37,7 @@
|
|
|
38
37
|
:languages="langs"
|
|
39
38
|
:fields="getFields(model)"
|
|
40
39
|
:errors="getErrors(index)"
|
|
40
|
+
:readonly="readonly"
|
|
41
41
|
>
|
|
42
42
|
<template
|
|
43
43
|
v-for="(slot, name) in templateSlots(model, $slots)"
|
|
@@ -96,9 +96,9 @@
|
|
|
96
96
|
>
|
|
97
97
|
</div>
|
|
98
98
|
</div>
|
|
99
|
-
<v-divider />
|
|
100
99
|
</div>
|
|
101
100
|
</draggable>
|
|
101
|
+
<v-divider/>
|
|
102
102
|
<div class="d-flex justify-end">
|
|
103
103
|
<v-btn
|
|
104
104
|
class="repeater-add-line"
|
|
@@ -175,7 +175,11 @@
|
|
|
175
175
|
overflow: hidden;
|
|
176
176
|
text-overflow: ellipsis;
|
|
177
177
|
}
|
|
178
|
+
.theme--light .repeater-line-wrapper { border-color: rgba(0, 0, 0, 0.12); }
|
|
178
179
|
.repeater-line-wrapper {
|
|
180
|
+
border: 1px solid;
|
|
181
|
+
border-bottom: none;
|
|
182
|
+
border-color: rgba(255, 255, 255, 0.12);
|
|
179
183
|
&:hover {
|
|
180
184
|
.repeater-action {
|
|
181
185
|
display: inline-flex;
|
|
@@ -220,7 +224,9 @@
|
|
|
220
224
|
.repeater-handle-sort {
|
|
221
225
|
position: absolute;
|
|
222
226
|
align-self: center;
|
|
223
|
-
bottom:
|
|
227
|
+
bottom: 0px;
|
|
228
|
+
height: 15px;
|
|
229
|
+
overflow: hidden;
|
|
224
230
|
cursor: grab;
|
|
225
231
|
}
|
|
226
232
|
}
|
|
@@ -306,6 +312,7 @@ export default {
|
|
|
306
312
|
},
|
|
307
313
|
// This is mainly an internal property. It is used by DetailField to pass the active language inherited from the Detail component.
|
|
308
314
|
currentLang: String,
|
|
315
|
+
maxHeight: String | Number
|
|
309
316
|
},
|
|
310
317
|
watch: {
|
|
311
318
|
value(val) {
|
|
@@ -418,6 +425,12 @@ export default {
|
|
|
418
425
|
}
|
|
419
426
|
return Object.values(templates);
|
|
420
427
|
},
|
|
428
|
+
maxHeightStyle(){
|
|
429
|
+
if (this.maxHeight !== undefined){
|
|
430
|
+
const maxHeight = isNaN(this.maxHeight) ? this.maxHeight : `${this.maxHeight}px`
|
|
431
|
+
return { maxHeight, paddingTop: '15px', overflowX: 'hidden', overflowY: 'auto' }
|
|
432
|
+
}
|
|
433
|
+
}
|
|
421
434
|
},
|
|
422
435
|
mounted() {
|
|
423
436
|
this.items = this.value;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div class="preview">
|
|
4
4
|
<span class="preview__title">{{ getTitle }}</span>
|
|
5
5
|
<br />
|
|
6
|
-
<span class="preview__url">{{ getPermalink }}</span>
|
|
6
|
+
<span class="preview__url">{{domain}}{{ getPermalink }}</span>
|
|
7
7
|
<br />
|
|
8
8
|
<span class="preview__desc">{{ getDescription }}</span>
|
|
9
9
|
</div>
|
|
@@ -58,13 +58,17 @@ export default {
|
|
|
58
58
|
// Seo permalink
|
|
59
59
|
permalink: {
|
|
60
60
|
type: String,
|
|
61
|
-
default: "
|
|
61
|
+
default: "how-to-dive"
|
|
62
62
|
},
|
|
63
63
|
// Seo description
|
|
64
64
|
description: {
|
|
65
65
|
type: String,
|
|
66
66
|
default:
|
|
67
67
|
"This is an example description that will get replaced when you start typing. Make sure to keep descriptions mobile-friendly and keyword-rich!"
|
|
68
|
+
},
|
|
69
|
+
domain: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: process.browser ? `${window.location.origin}/` : ""
|
|
68
72
|
}
|
|
69
73
|
},
|
|
70
74
|
computed: {
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/uikit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.23",
|
|
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.23",
|
|
11
11
|
"@nuxtjs/vuetify": "^1.12.3",
|
|
12
12
|
"vuedraggable": "^2.24.3"
|
|
13
13
|
},
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "19399823330cb0123d2b224e857fb3094351df95"
|
|
18
18
|
}
|