@mapomodule/uikit 1.0.0-alpha.1 → 1.0.0-alpha.6
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 +69 -0
- package/LICENSE.md +20 -0
- package/components/Detail/Detail.vue +147 -90
- package/components/Detail/DetailField.vue +14 -11
- package/components/Detail/defaults.js +6 -1
- package/components/List/List.vue +100 -40
- package/components/List/ListActions.vue +38 -17
- package/components/List/ListFilters.vue +127 -113
- package/components/List/ListHead.vue +22 -12
- package/components/List/ListQuickEdit.vue +14 -5
- package/components/List/ListTable.vue +202 -76
- package/components/fields/SeoPreview.vue +89 -0
- package/components/fields/TinyMce/TinyMce.vue +4 -1
- package/components/fields/TinyMce/defaults.js +1 -1
- package/components/layout/Sidebar/Sidebar.vue +46 -24
- package/components/layout/Sidebar/SidebarFooter.vue +41 -46
- package/components/layout/Sidebar/SidebarList.vue +10 -13
- package/components/layout/Sidebar/SidebarListItem.vue +29 -45
- package/components/layout/Topbar/Topbar.vue +3 -36
- package/components/layout/routebuilder.js +1 -1
- package/layouts/default.vue +2 -11
- package/package.json +2 -2
- package/pages/index.vue +15 -78
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# [1.0.0-alpha.6](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2021-12-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **uikit:** fix sidebar footer items not collapsing on mini variant ([04c510e](https://github.com/lotrekagency/mapo/commit/04c510ee87bd7b74161725c366e2eac2bd3efe9f))
|
|
12
|
+
* **uikit:** fix sidebar items not collapsing on mini variant ([67a9524](https://github.com/lotrekagency/mapo/commit/67a9524b17b6cbdf455b8e6f56f7cc0674b1dbed))
|
|
13
|
+
* various css fixes ([658c363](https://github.com/lotrekagency/mapo/commit/658c3636e869f0a2bd53efe41295cf87d6af3962))
|
|
14
|
+
* **list:** fix v-menu position on large screens ([41bd08d](https://github.com/lotrekagency/mapo/commit/41bd08d36d85e685a755c7e0de97bbb05a24c03d))
|
|
15
|
+
* **list:** fixed v-menu filter positioning ([e99848e](https://github.com/lotrekagency/mapo/commit/e99848e0beb2df124db1ba9968696bbe8ee7b683))
|
|
16
|
+
* **list:** fixed v-menu position for filters ([cb95260](https://github.com/lotrekagency/mapo/commit/cb9526085d536ff7b468316b1d2571c7ae9509d8))
|
|
17
|
+
* **list:** load page from query params ([88dea98](https://github.com/lotrekagency/mapo/commit/88dea98063cdab79c9c518fe0e3bf8d3c90f0161))
|
|
18
|
+
* **list:** refactoring for injected elements and FE pagination ([f9c968e](https://github.com/lotrekagency/mapo/commit/f9c968e0edf87654df60781d7d2d465d15e40ab9))
|
|
19
|
+
* **list:** removed lock to BE pagination if items in list are less than itemsPerPage ([3fe34e0](https://github.com/lotrekagency/mapo/commit/3fe34e0d1438a0980e8819070f9b158ad3b6e0b8))
|
|
20
|
+
* **uikit:** better handle detail component lang switches ([5297e49](https://github.com/lotrekagency/mapo/commit/5297e4956536b382600c250f5c797c8db5e58f84))
|
|
21
|
+
* **uikit:** fix detailfield not reading conf value changes ([5628268](https://github.com/lotrekagency/mapo/commit/5628268e4e78201523eba60adaf17286dfb38c8b))
|
|
22
|
+
* **uikit:** fix lang changhe in detail component ([32494f7](https://github.com/lotrekagency/mapo/commit/32494f7d094f7e9cebc14f7524ad716eb89fd6d7))
|
|
23
|
+
* **uikit:** fix positioning of element in list component and subcomponents ([887c3b6](https://github.com/lotrekagency/mapo/commit/887c3b6aae52d1a3494ebcc01f0f155f21373f9c))
|
|
24
|
+
* **uikit:** set endpoint to default null in detail field ([5c9296c](https://github.com/lotrekagency/mapo/commit/5c9296c81f8667319699e933f528c4c05a1f541d))
|
|
25
|
+
* fixed v-model with datepicker filter ([ef4634e](https://github.com/lotrekagency/mapo/commit/ef4634e8ad0719ec2991a8c40a87191c0e32d7ec))
|
|
26
|
+
* load saved date range into datepicker ([eb94dd5](https://github.com/lotrekagency/mapo/commit/eb94dd5686b9fed16e0f39bf122c767d8bd1017b))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* **list:** added support to offline items ([495fd1f](https://github.com/lotrekagency/mapo/commit/495fd1f30cd0adc228b48ca4384b9df572e69216))
|
|
32
|
+
* **list:** handle multisort ([41feb88](https://github.com/lotrekagency/mapo/commit/41feb88ec15be5cc9afbcdf3d2dea23142301153))
|
|
33
|
+
* **uikit:** add possibility to remove icon from sidebar ([106d85f](https://github.com/lotrekagency/mapo/commit/106d85f576cdc9e6438b48fa8e695315cac2262b))
|
|
34
|
+
* **uikit:** added langChange event to detail component ([70d3430](https://github.com/lotrekagency/mapo/commit/70d3430694e67dfcd65539a3d474847123e05db5))
|
|
35
|
+
* **uikit:** added possibility to change detail component current lang fromprop ([1993aa7](https://github.com/lotrekagency/mapo/commit/1993aa74a66768eea319f41a41878916544adcbb))
|
|
36
|
+
* **uikit:** added possibility to override field container class in detail component with key class in field configuration ([afe1e52](https://github.com/lotrekagency/mapo/commit/afe1e522683d08c5e63650e55dbe2f9a9404e681))
|
|
37
|
+
* **uikit:** added seopreview field ([03e52fe](https://github.com/lotrekagency/mapo/commit/03e52fed08e60c8b43226856a8d05d4c724ad9b2))
|
|
38
|
+
* **uikit:** added v-model to Detail Component, now you can bind the payload externally from detail field. ([a50b082](https://github.com/lotrekagency/mapo/commit/a50b08261d6b8eba3e5b6f1ea2f1f4bb0d591b8e))
|
|
39
|
+
* **uikit:** display errors on tinymce component also with red label shake animation ([2c9e158](https://github.com/lotrekagency/mapo/commit/2c9e158090ee1f770518ad755437171a1b16afbd))
|
|
40
|
+
* **uikit:** newsidebar built with vuetify components to better support theming ([9cc237f](https://github.com/lotrekagency/mapo/commit/9cc237fa7dcfe193edc0fd9cb90e3bbbb103931d))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# [1.0.0-alpha.5](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2021-12-20)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Bug Fixes
|
|
50
|
+
|
|
51
|
+
* **uikit:** fix list component http call with no pagination at all ([ebe4b61](https://github.com/lotrekagency/mapo/commit/ebe4b617f3be5ccb70c10c041c81868e9ee6b828))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* added search field on list component ([0c845e2](https://github.com/lotrekagency/mapo/commit/0c845e26e30afed66b351cc7a0f940f9a20e0943))
|
|
57
|
+
* select all option on list component ([588d2c5](https://github.com/lotrekagency/mapo/commit/588d2c57ca5fd36477cf1ee3c33e2289eb979acf))
|
|
58
|
+
* slot for selected items' counter ([0551b5e](https://github.com/lotrekagency/mapo/commit/0551b5e916f25fc740a0cae58c5548ab0c6e35ff))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# [1.0.0-alpha.4](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2021-10-25)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Bug Fixes
|
|
68
|
+
|
|
69
|
+
* Display corret version of mapo in index page ([22ae4cf](https://github.com/lotrekagency/mapo/commit/22ae4cf55f1f3c6fcda64b085fe3c13c416bafb8))
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Lotrek 2021
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
@@ -26,47 +26,55 @@
|
|
|
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">
|
|
38
|
+
<v-card-title>
|
|
39
|
+
<v-icon left> {{ field.group.icon }} </v-icon>
|
|
40
|
+
<span>{{ field.group.name }}</span>
|
|
41
|
+
</v-card-title>
|
|
42
|
+
<v-card-text class="row">
|
|
43
|
+
<div
|
|
44
|
+
v-for="(fields, fieldsI) in field.fields"
|
|
45
|
+
:key="fieldsI"
|
|
46
|
+
class="col-12"
|
|
47
|
+
:class="fields.class"
|
|
48
|
+
>
|
|
49
|
+
<!-- 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`. -->
|
|
50
|
+
<slot
|
|
51
|
+
:name="fields.slotName"
|
|
52
|
+
v-bind="{
|
|
53
|
+
conf: fields,
|
|
54
|
+
...slotBindings,
|
|
55
|
+
}"
|
|
56
|
+
>
|
|
57
|
+
<!-- A [`DetailField`](/components/detail/DetailField/) configured by a [`FieldConfiguration`](#fieldconfiguration). -->
|
|
58
|
+
<DetailField
|
|
59
|
+
v-model="model"
|
|
60
|
+
:conf="fields"
|
|
61
|
+
:errors="errors"
|
|
62
|
+
/>
|
|
63
|
+
</slot>
|
|
64
|
+
</div>
|
|
65
|
+
</v-card-text>
|
|
66
|
+
</v-card>
|
|
67
|
+
<slot
|
|
68
|
+
v-else
|
|
69
|
+
:name="field.slotName"
|
|
70
|
+
v-bind="{
|
|
71
|
+
conf: field,
|
|
72
|
+
...slotBindings,
|
|
73
|
+
}"
|
|
74
|
+
>
|
|
75
|
+
<DetailField v-model="model" :conf="field" :errors="errors" />
|
|
76
|
+
</slot>
|
|
77
|
+
</div>
|
|
70
78
|
</div>
|
|
71
79
|
</slot>
|
|
72
80
|
<!-- Use this to add content under the main body. -->
|
|
@@ -118,45 +126,53 @@
|
|
|
118
126
|
</slot>
|
|
119
127
|
<!-- Use this to add content on the top of the sidebar fields (or under sidebar buttons). -->
|
|
120
128
|
<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
|
-
}"
|
|
129
|
+
<div class="row">
|
|
130
|
+
<div
|
|
131
|
+
class="col-12"
|
|
132
|
+
:class="field.class"
|
|
133
|
+
v-for="(field, index) in sideFields"
|
|
134
|
+
:key="index"
|
|
157
135
|
>
|
|
158
|
-
<
|
|
159
|
-
|
|
136
|
+
<v-card v-if="field.group" class="mb-4">
|
|
137
|
+
<v-card-title>
|
|
138
|
+
<v-icon left> {{ field.group.icon }} </v-icon>
|
|
139
|
+
<span>{{ field.group.name }}</span>
|
|
140
|
+
</v-card-title>
|
|
141
|
+
<v-card-text class="row">
|
|
142
|
+
<div
|
|
143
|
+
v-for="(fields, fieldsI) in field.fields"
|
|
144
|
+
:key="fieldsI"
|
|
145
|
+
class="col-12"
|
|
146
|
+
:class="field.class"
|
|
147
|
+
>
|
|
148
|
+
<!-- @vuese-ignore -->
|
|
149
|
+
<slot
|
|
150
|
+
:name="fields.slotName"
|
|
151
|
+
v-bind="{
|
|
152
|
+
conf: fields,
|
|
153
|
+
...slotBindings,
|
|
154
|
+
}"
|
|
155
|
+
>
|
|
156
|
+
<DetailField
|
|
157
|
+
v-model="model"
|
|
158
|
+
:conf="fields"
|
|
159
|
+
:errors="errors"
|
|
160
|
+
/>
|
|
161
|
+
</slot>
|
|
162
|
+
</div>
|
|
163
|
+
</v-card-text>
|
|
164
|
+
</v-card>
|
|
165
|
+
<slot
|
|
166
|
+
v-else
|
|
167
|
+
:name="field.slotName"
|
|
168
|
+
v-bind="{
|
|
169
|
+
conf: field,
|
|
170
|
+
...slotBindings,
|
|
171
|
+
}"
|
|
172
|
+
>
|
|
173
|
+
<DetailField v-model="model" :conf="field" :errors="errors" />
|
|
174
|
+
</slot>
|
|
175
|
+
</div>
|
|
160
176
|
</div>
|
|
161
177
|
<!-- Use this to add content under the sidebar fields. -->
|
|
162
178
|
<slot name="side.bottom" v-bind="slotBindings"></slot>
|
|
@@ -183,6 +199,16 @@ export default {
|
|
|
183
199
|
};
|
|
184
200
|
},
|
|
185
201
|
props: {
|
|
202
|
+
// V-model of the object we are editing.
|
|
203
|
+
value: {
|
|
204
|
+
type: Object,
|
|
205
|
+
required: false
|
|
206
|
+
},
|
|
207
|
+
// Set the current lang to value.
|
|
208
|
+
lang: {
|
|
209
|
+
type: String,
|
|
210
|
+
required: false
|
|
211
|
+
},
|
|
186
212
|
// The main configuration that determines the arrangement of the fields in the detail layout.
|
|
187
213
|
fields: {
|
|
188
214
|
// [`DetailConfiguration`](#detailconfiguration)
|
|
@@ -195,7 +221,10 @@ export default {
|
|
|
195
221
|
default: () => []
|
|
196
222
|
},
|
|
197
223
|
// 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:
|
|
224
|
+
endpoint: {
|
|
225
|
+
type: String,
|
|
226
|
+
default: null
|
|
227
|
+
},
|
|
199
228
|
// The identifier of the object you need to retrieve and edit. It can be "new" if you need to create a new payload.
|
|
200
229
|
identifier: {
|
|
201
230
|
// `String|Number`.
|
|
@@ -247,12 +276,22 @@ export default {
|
|
|
247
276
|
}
|
|
248
277
|
});
|
|
249
278
|
},
|
|
250
|
-
|
|
279
|
+
initLang(lang = this.currentLang) {
|
|
280
|
+
if (lang && !this.model.translations) {
|
|
281
|
+
this.model.translations = {};
|
|
282
|
+
}
|
|
283
|
+
if (lang && !this.model.translations[lang]) {
|
|
284
|
+
this.model.translations[lang] = {};
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
parseConf(field, i) {
|
|
251
288
|
const conf = typeof field === "string" ? { value: field } : field;
|
|
252
|
-
conf.value = conf.value
|
|
253
|
-
conf.
|
|
289
|
+
conf.value = conf.value || "";
|
|
290
|
+
conf.value = conf.value.replace(new RegExp(`^translations\.(${this.languages.join("|")})\.?`), "");
|
|
291
|
+
conf.slotName = `fields.${conf.value || i}`;
|
|
254
292
|
if (this.currentLang && !field.synci18n) {
|
|
255
|
-
|
|
293
|
+
const base = `translations.${this.currentLang}`;
|
|
294
|
+
conf.value = (conf.value && `${base}.${conf.value}`) || base;
|
|
256
295
|
}
|
|
257
296
|
return conf;
|
|
258
297
|
},
|
|
@@ -262,20 +301,34 @@ export default {
|
|
|
262
301
|
typeof group === "string"
|
|
263
302
|
? { name: group, icon }
|
|
264
303
|
: { ...group, icon: group.icon || icon };
|
|
265
|
-
return fields.map(f =>
|
|
304
|
+
return fields.map((f, i) =>
|
|
266
305
|
f.group
|
|
267
306
|
? { group: parseGroup(f.group), fields: this.mapConf(f.fields) }
|
|
268
|
-
: this.parseConf(f)
|
|
307
|
+
: this.parseConf(f, i)
|
|
269
308
|
);
|
|
270
309
|
}
|
|
271
310
|
},
|
|
272
311
|
watch: {
|
|
273
312
|
currentLang(val) {
|
|
274
|
-
|
|
275
|
-
|
|
313
|
+
this.initLang();
|
|
314
|
+
// Fired when the current language changes.
|
|
315
|
+
// @arg Emits the language name as a string.
|
|
316
|
+
this.$emit("update:lang", val);
|
|
317
|
+
},
|
|
318
|
+
model(val) {
|
|
319
|
+
// Fired when the v-model changes.
|
|
320
|
+
// @arg Emits the entire payload modified.
|
|
321
|
+
this.$emit("input", val);
|
|
322
|
+
},
|
|
323
|
+
lang(val) {
|
|
324
|
+
if (val && this.langs.includes(val)) {
|
|
325
|
+
this.currentLang = val;
|
|
276
326
|
}
|
|
277
|
-
|
|
278
|
-
|
|
327
|
+
},
|
|
328
|
+
value(val) {
|
|
329
|
+
if (val) {
|
|
330
|
+
this.model = val;
|
|
331
|
+
this.initLang();
|
|
279
332
|
}
|
|
280
333
|
}
|
|
281
334
|
},
|
|
@@ -331,7 +384,10 @@ export default {
|
|
|
331
384
|
},
|
|
332
385
|
mounted() {
|
|
333
386
|
if (this.identifier && this.identifier !== "new") {
|
|
334
|
-
this.crud.detail(this.identifier).then(res =>
|
|
387
|
+
this.crud.detail(this.identifier).then(res => {
|
|
388
|
+
this.model = res;
|
|
389
|
+
this.initLang();
|
|
390
|
+
});
|
|
335
391
|
}
|
|
336
392
|
}
|
|
337
393
|
};
|
|
@@ -446,6 +502,7 @@ export default {
|
|
|
446
502
|
"title",
|
|
447
503
|
{ value: "description", type: "textarea" },
|
|
448
504
|
"permalink",
|
|
505
|
+
{ type: "seoPreview" }
|
|
449
506
|
]
|
|
450
507
|
}
|
|
451
508
|
],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component :is="is" v-model="model" v-bind="
|
|
2
|
+
<component :is="is" v-model="model" v-bind="fieldAttrs"></component>
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script>
|
|
@@ -8,6 +8,8 @@ import DateField from "@mapomodule/uikit/components/fields/DateField.vue";
|
|
|
8
8
|
import M2mField from "@mapomodule/uikit/components/fields/M2mField.vue";
|
|
9
9
|
import MediaM2mField from "@mapomodule/uikit/components/fields/MediaM2mField.vue";
|
|
10
10
|
import MediaField from "@mapomodule/uikit/components/fields/MediaField.vue";
|
|
11
|
+
import SeoPreview from "@mapomodule/uikit/components/fields/SeoPreview.vue";
|
|
12
|
+
|
|
11
13
|
|
|
12
14
|
import { getPointed, setPointed } from "@mapomodule/utils/helpers/objHelpers";
|
|
13
15
|
import defaults from "./defaults";
|
|
@@ -22,15 +24,16 @@ export default {
|
|
|
22
24
|
DateField,
|
|
23
25
|
M2mField,
|
|
24
26
|
MediaM2mField,
|
|
25
|
-
MediaField
|
|
27
|
+
MediaField,
|
|
28
|
+
SeoPreview
|
|
26
29
|
},
|
|
27
30
|
|
|
28
31
|
data() {
|
|
29
32
|
return {
|
|
30
33
|
model: null,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
defaultMap: defaults.mapping,
|
|
35
|
+
defaultAttrs: defaults.props,
|
|
36
|
+
defaultAccess: defaults.accessor
|
|
34
37
|
};
|
|
35
38
|
},
|
|
36
39
|
props: {
|
|
@@ -55,8 +58,8 @@ export default {
|
|
|
55
58
|
this.setModel(val);
|
|
56
59
|
}
|
|
57
60
|
},
|
|
58
|
-
conf(
|
|
59
|
-
if (
|
|
61
|
+
"conf.value"(newValue, oldValue) {
|
|
62
|
+
if (newValue !== oldValue) {
|
|
60
63
|
this.setModel();
|
|
61
64
|
}
|
|
62
65
|
},
|
|
@@ -90,15 +93,15 @@ export default {
|
|
|
90
93
|
return {
|
|
91
94
|
get: func,
|
|
92
95
|
set: func,
|
|
93
|
-
...(this.
|
|
96
|
+
...(this.defaultAccess[this.is] || {}),
|
|
94
97
|
...this.conf.accessor
|
|
95
98
|
};
|
|
96
99
|
},
|
|
97
|
-
|
|
100
|
+
fieldAttrs() {
|
|
98
101
|
return {
|
|
99
102
|
label: this.label,
|
|
100
103
|
errorMessages: getPointed(this.errors || {}, this.conf.value, []),
|
|
101
|
-
...(this.
|
|
104
|
+
...(this.defaultAttrs[this.is] || {}),
|
|
102
105
|
...this.conf.attrs
|
|
103
106
|
};
|
|
104
107
|
},
|
|
@@ -120,7 +123,7 @@ export default {
|
|
|
120
123
|
is() {
|
|
121
124
|
return (
|
|
122
125
|
this.conf.is ||
|
|
123
|
-
(this.conf.type && this.
|
|
126
|
+
(this.conf.type && this.defaultMap[this.conf.type]) ||
|
|
124
127
|
"v-text-field"
|
|
125
128
|
);
|
|
126
129
|
}
|
|
@@ -9,7 +9,8 @@ const mapping = {
|
|
|
9
9
|
editor: "tiny-mce",
|
|
10
10
|
media: "media-field",
|
|
11
11
|
m2m: "m2m-field",
|
|
12
|
-
mediaList: "media-m2m-field"
|
|
12
|
+
mediaList: "media-m2m-field",
|
|
13
|
+
seoPreview: "seo-preview"
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const props = {
|
|
@@ -43,6 +44,10 @@ const accessor = {
|
|
|
43
44
|
},
|
|
44
45
|
"date-field": {
|
|
45
46
|
get: dateFunc, set: dateFunc
|
|
47
|
+
},
|
|
48
|
+
"seo-preview": {
|
|
49
|
+
get: ({ val }) => ({ title: "", permalink: "", description: "", ...val }),
|
|
50
|
+
set: ({ val }) => ({ title: "", permalink: "", description: "", ...val })
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
export default {
|