@mapomodule/uikit 1.0.0-alpha.37 → 1.0.0-alpha.39
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 +59 -0
- package/components/Detail/Detail.vue +59 -25
- package/components/Detail/DetailLangSwitch.vue +5 -0
- package/components/Form/Form.vue +4 -4
- package/components/Form/FormField.vue +90 -89
- package/components/Form/FormGroup.vue +32 -2
- package/components/Form/FormTabs.vue +32 -1
- package/components/Form/defaults.js +49 -18
- package/components/Form/fields/ColorField.vue +5 -2
- package/components/Form/fields/DateField.vue +7 -1
- package/components/Form/fields/MediaField.vue +5 -2
- package/components/Form/fields/MediaM2mField.vue +11 -6
- package/components/Form/fields/wygEditor/defaults.js +20 -52
- package/components/Form/fields/wygEditor/wygEditor.vue +48 -19
- package/components/List/ListTable.vue +1 -1
- package/components/MediaManager/MediaBreadcrumbs.vue +3 -2
- package/components/MediaManager/MediaFolders.vue +2 -41
- package/components/layout/Sidebar/Sidebar.vue +38 -10
- package/components/layout/Sidebar/SidebarList.vue +4 -6
- package/components/layout/Sidebar/SidebarListItem.vue +11 -0
- package/components/layout/Sidebar/SidebarTitle.vue +45 -0
- package/components/layout/Topbar/Topbar.vue +11 -10
- package/defaults/vuetify.js +8 -7
- package/package.json +2 -2
- package/static/{favicon.ico → mapo/favicon.ico} +0 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
- package/components/layout/Sidebar/SidebarFooter.vue +0 -52
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,65 @@
|
|
|
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.39](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.38...v1.0.0-alpha.39) (2022-12-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix class inheritance for field border radius ([33f1fd9](https://github.com/lotrekagency/mapo/commit/33f1fd9e41edb9f3a396ee8a4c1a7431072b885a))
|
|
12
|
+
* fix list table to fallback to unknown string if navigable but no column value ([dcf400f](https://github.com/lotrekagency/mapo/commit/dcf400f5a728246a9251a464c2d9739246092b9a))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* give the option to rewrite form fields components defaults in nuxt.config.js ([c4e76b1](https://github.com/lotrekagency/mapo/commit/c4e76b153b145cc670ef988e9501e1a8fbc0005e))
|
|
18
|
+
* pass classes also to groups and tabs in formfields ([e975aab](https://github.com/lotrekagency/mapo/commit/e975aabea4ae62be2285262fed8852af45a69f48))
|
|
19
|
+
* restyle media m2m field ([a79e976](https://github.com/lotrekagency/mapo/commit/a79e9763949b032a37180fefbd8a98ad8e0b05a0))
|
|
20
|
+
* specific class names for detail component parts and configurable sidenav col ([e6a5887](https://github.com/lotrekagency/mapo/commit/e6a588712774080dddcf01fb832a0729babb16a7))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Performance Improvements
|
|
24
|
+
|
|
25
|
+
* dynamically import components in FormField to reduce bundle size ([85986c6](https://github.com/lotrekagency/mapo/commit/85986c6859a00d8039dd7e9f703f5dd4b668361f))
|
|
26
|
+
* treeshake vuetify to reduce vendor bundle ([42b31b3](https://github.com/lotrekagency/mapo/commit/42b31b38eb04d561bba1535d8e05d91353679027))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# [1.0.0-alpha.38](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.37...v1.0.0-alpha.38) (2022-11-22)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* append color icon in color field ([7d17806](https://github.com/lotrekagency/mapo/commit/7d178067ccea0304df744c53f0b6142a54667f51))
|
|
38
|
+
* clear tinymce content on startup ([e8e3599](https://github.com/lotrekagency/mapo/commit/e8e35998fd56cb832493a7a2d54c941e8ecc2fe2))
|
|
39
|
+
* fix layout shift of media field after media selection ([b59e0f2](https://github.com/lotrekagency/mapo/commit/b59e0f26fee3b0b670d787dcb0b423690d389885))
|
|
40
|
+
* fix static resources base path ([ed8351d](https://github.com/lotrekagency/mapo/commit/ed8351d55f3c1cfee435faec4ebc684bb92a1e78))
|
|
41
|
+
* fix tinymce skin mapo-light menu hover color ([c176df8](https://github.com/lotrekagency/mapo/commit/c176df88616a8554231cd8f660d63a064595be3e))
|
|
42
|
+
* remove settings link ([d4be262](https://github.com/lotrekagency/mapo/commit/d4be262deb0c55fccda8de60adb7111a6136beed))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Features
|
|
46
|
+
|
|
47
|
+
* added error state for wyg editor based on mapo field error state ([c1f2dbd](https://github.com/lotrekagency/mapo/commit/c1f2dbd2e2ed7308396a3497cfbe44cd072d6ee4))
|
|
48
|
+
* added error state to mapofield and reduced div nesting ([751ffeb](https://github.com/lotrekagency/mapo/commit/751ffeb40572d4755a467cacbbd9731d761651b7))
|
|
49
|
+
* added slots for sidebar and topbar ([7ac86e7](https://github.com/lotrekagency/mapo/commit/7ac86e7d71347bb0b57b7a175a887afa4c0030d7))
|
|
50
|
+
* auto hideDetails on fields without error messages ([7654bf3](https://github.com/lotrekagency/mapo/commit/7654bf3854224596587bdeb461c3dd1d11a6e1a3))
|
|
51
|
+
* tinymce better theming ([c1c5c88](https://github.com/lotrekagency/mapo/commit/c1c5c88d9e1b46dcc008491d55bb52ee4e7296e4))
|
|
52
|
+
* tinymce enhancements and theming ([5bb1168](https://github.com/lotrekagency/mapo/commit/5bb1168bcad8dcfc735a0ccf10f891a827520391))
|
|
53
|
+
* update style of form groups ([a4d9238](https://github.com/lotrekagency/mapo/commit/a4d9238625a19ba16ecf692069515c986ffcf615))
|
|
54
|
+
* update vuetify color scheme ([18aff8d](https://github.com/lotrekagency/mapo/commit/18aff8dc0de8c868e62f26df048a12dd97ef2f2b))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Performance Improvements
|
|
58
|
+
|
|
59
|
+
* decrease div nesting in forms ([537a59c](https://github.com/lotrekagency/mapo/commit/537a59c884dce7ae4d959724349956246c1fd680))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
6
65
|
# [1.0.0-alpha.37](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2022-11-14)
|
|
7
66
|
|
|
8
67
|
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div v-if="loading">
|
|
2
|
+
<div class="mapo-detail--wrapper">
|
|
3
|
+
<div class="mapo-detail--loader" v-if="loading">
|
|
4
4
|
<v-progress-linear
|
|
5
5
|
color="primary"
|
|
6
6
|
indeterminate
|
|
7
7
|
absolute
|
|
8
|
-
style="top: 0;"
|
|
9
8
|
></v-progress-linear>
|
|
10
|
-
<span class="detail-component-loading
|
|
9
|
+
<span class="detail-component-loading">
|
|
11
10
|
<v-icon size="30">mdi-timer-sand</v-icon>
|
|
12
11
|
{{ $t('mapo.fetchingData') }}
|
|
13
12
|
</span>
|
|
14
13
|
</div>
|
|
15
|
-
<div v-else>
|
|
14
|
+
<div class="mapo-detail--loaded" v-else>
|
|
16
15
|
<!-- Use this to override the title of the detail component. -->
|
|
17
16
|
<slot name="title" v-bind="slotBindings">
|
|
18
17
|
<!-- `<h1> "Create | Edit" + modelName </h1>` -->
|
|
19
|
-
<
|
|
20
|
-
<v-col col="12"><h1 class="display-1">{{ isNew ? $t("mapo.create") : $t("mapo.edit") }} {{ modelName }}</h1></v-col>
|
|
21
|
-
</v-row>
|
|
18
|
+
<h1 class="mapo-detail--title">{{ isNew ? $t("mapo.create") : $t("mapo.edit") }} {{ modelName }}</h1>
|
|
22
19
|
</slot>
|
|
23
|
-
<v-form ref="form">
|
|
20
|
+
<v-form class="mapo-detail--form" ref="form">
|
|
24
21
|
<v-row>
|
|
25
|
-
<v-col cols="12" md="
|
|
22
|
+
<v-col class="mapo-detail--main" cols="12" :md="12 - sidenavCol">
|
|
26
23
|
<!-- Use this to add content at the top of the central layout. -->
|
|
27
24
|
<slot name="body.top" v-bind="slotBindings"></slot>
|
|
28
25
|
<!-- Use this to override the Language Switch panel. -->
|
|
@@ -31,7 +28,7 @@
|
|
|
31
28
|
<DetailLangSwitch
|
|
32
29
|
v-if="langs && langs.length"
|
|
33
30
|
v-show="langs.length > 1"
|
|
34
|
-
class="
|
|
31
|
+
class="mapo-detail--language-tabs"
|
|
35
32
|
v-model="currentLang"
|
|
36
33
|
:langs="langs"
|
|
37
34
|
:errors="errors"
|
|
@@ -62,32 +59,32 @@
|
|
|
62
59
|
<!-- Use this to add content under the main body. -->
|
|
63
60
|
<slot name="body.bottom" v-bind="slotBindings"></slot>
|
|
64
61
|
</v-col>
|
|
65
|
-
<v-col cols="12" md="
|
|
66
|
-
<div class="
|
|
62
|
+
<v-col class="mapo-detail--sidenav" cols="12" :md="sidenavCol">
|
|
63
|
+
<div class="mapo-detail--sidenav-col" :style="stickySide">
|
|
67
64
|
<!-- Use this to add content on the top of the sidebar button panel. -->
|
|
68
65
|
<slot name="side.buttons.top" v-bind="slotBindings"></slot>
|
|
69
66
|
<!-- Use this to override the the sidebar button panel. -->
|
|
70
67
|
<slot name="side.buttons" v-bind="slotBindings">
|
|
71
68
|
<!-- Save, Save and continue, Back, and Delete buttons. -->
|
|
72
|
-
<div class="
|
|
69
|
+
<div class="mapo-detail--buttons">
|
|
73
70
|
<!-- Use this to override the Save button. -->
|
|
74
71
|
<slot name="button.save" v-bind="slotBindings">
|
|
75
72
|
<!-- The Save button. -->
|
|
76
|
-
<v-btn v-show="canGoBack" :loading="buttonClicked == 'saveAndBackBtn'" :disabled="isReadonly"
|
|
73
|
+
<v-btn v-show="canGoBack" :loading="buttonClicked == 'saveAndBackBtn'" :disabled="isReadonly" tile block @click="saveItem(true)">{{
|
|
77
74
|
isNew ? $t("mapo.create") : $t("mapo.save")
|
|
78
75
|
}}</v-btn>
|
|
79
76
|
</slot>
|
|
80
77
|
<!-- Use this to override the Save and continue button. -->
|
|
81
78
|
<slot name="button.savecontinue" v-bind="slotBindings">
|
|
82
79
|
<!-- The Save and continue button. -->
|
|
83
|
-
<v-btn :loading="buttonClicked == 'saveBtn'" :disabled="isReadonly"
|
|
80
|
+
<v-btn :loading="buttonClicked == 'saveBtn'" :disabled="isReadonly" tile block @click="saveItem(false)"
|
|
84
81
|
>{{ isNew ? $t("mapo.createContinue") : $t("mapo.saveContinue") }}</v-btn
|
|
85
82
|
>
|
|
86
83
|
</slot>
|
|
87
84
|
<!-- Use this to override the Back button. -->
|
|
88
85
|
<slot name="button.back" v-bind="slotBindings">
|
|
89
86
|
<!-- The Back button. -->
|
|
90
|
-
<v-btn v-show="canGoBack"
|
|
87
|
+
<v-btn v-show="canGoBack" tile block @click="back"
|
|
91
88
|
>{{ $t("mapo.back") }}</v-btn
|
|
92
89
|
>
|
|
93
90
|
</slot>
|
|
@@ -96,7 +93,6 @@
|
|
|
96
93
|
<!-- The Delete button. -->
|
|
97
94
|
<v-btn
|
|
98
95
|
v-if="!isNew"
|
|
99
|
-
class="mb-2"
|
|
100
96
|
color="error"
|
|
101
97
|
tile
|
|
102
98
|
block
|
|
@@ -137,15 +133,44 @@
|
|
|
137
133
|
</template>
|
|
138
134
|
|
|
139
135
|
<style lang="scss" scoped>
|
|
140
|
-
.detail
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
136
|
+
.mapo-detail--loader {
|
|
137
|
+
.v-progress-linear {
|
|
138
|
+
top: 0;
|
|
139
|
+
}
|
|
140
|
+
span{
|
|
141
|
+
position: absolute;
|
|
142
|
+
top: 50%;
|
|
143
|
+
transform: translateY(-50%);
|
|
144
|
+
width: 100%;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
align-items: center;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
.mapo-detail--title{
|
|
152
|
+
margin-bottom: 20px;
|
|
153
|
+
font-weight: normal;
|
|
154
|
+
}
|
|
155
|
+
.mapo-detail--language-tabs {
|
|
156
|
+
margin-bottom: 20px;
|
|
157
|
+
}
|
|
158
|
+
.mapo-detail--sidenav-col {
|
|
145
159
|
display: flex;
|
|
146
160
|
flex-direction: column;
|
|
147
|
-
|
|
148
|
-
|
|
161
|
+
}
|
|
162
|
+
.mapo-detail--buttons {
|
|
163
|
+
margin-top: 16px;
|
|
164
|
+
margin-bottom: 0px;
|
|
165
|
+
order: 1;
|
|
166
|
+
@media (min-width: 960px) {
|
|
167
|
+
margin-bottom: 16px;
|
|
168
|
+
margin-top: 0px;
|
|
169
|
+
order: 0;
|
|
170
|
+
}
|
|
171
|
+
.v-btn{
|
|
172
|
+
margin-bottom: 8px;
|
|
173
|
+
}
|
|
149
174
|
}
|
|
150
175
|
</style>
|
|
151
176
|
|
|
@@ -197,6 +222,15 @@ export default {
|
|
|
197
222
|
type: String,
|
|
198
223
|
default: null
|
|
199
224
|
},
|
|
225
|
+
// This determines the width of the sidebar in desktop view in a 12 col grid.
|
|
226
|
+
sidenavCol: {
|
|
227
|
+
type: Number | String,
|
|
228
|
+
default: "4",
|
|
229
|
+
validator: function (value) {
|
|
230
|
+
// The value must be a number between 0 and 12
|
|
231
|
+
return [...Array(12).keys()].indexOf(+value) !== -1;
|
|
232
|
+
},
|
|
233
|
+
},
|
|
200
234
|
// The identifier of the object you need to retrieve and edit. It can be "new" if you need to create a new payload.
|
|
201
235
|
identifier: {
|
|
202
236
|
// `String|Number`.
|
package/components/Form/Form.vue
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
</template>
|
|
50
50
|
</FormGroup>
|
|
51
51
|
|
|
52
|
-
<
|
|
52
|
+
<template v-else>
|
|
53
53
|
<slot :name="field.slotName + '.before'" v-bind="{ conf: field, ...slotBindings, }" />
|
|
54
54
|
<slot
|
|
55
55
|
:name="field.slotName"
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
</FormField>
|
|
77
77
|
</slot>
|
|
78
78
|
<slot :name="field.slotName + '.after'" v-bind="{ conf: field, ...slotBindings, }" />
|
|
79
|
-
</
|
|
79
|
+
</template>
|
|
80
80
|
</div>
|
|
81
81
|
</div>
|
|
82
82
|
</template>
|
|
@@ -178,9 +178,9 @@ export default {
|
|
|
178
178
|
mapConf(fields) {
|
|
179
179
|
return fields.map((f, i) =>
|
|
180
180
|
f.tabs
|
|
181
|
-
? { group: this.parseTagsGroup(f), tabs: this.parseTabs(f.tabs) }
|
|
181
|
+
? { ...f, group: this.parseTagsGroup(f), tabs: this.parseTabs(f.tabs) }
|
|
182
182
|
: f.group
|
|
183
|
-
? { group: this.parseGroup(f.group), fields: this.mapConf(f.fields) }
|
|
183
|
+
? { ...f, group: this.parseGroup(f.group), fields: this.mapConf(f.fields) }
|
|
184
184
|
: this.parseConf(f, i)
|
|
185
185
|
);
|
|
186
186
|
},
|
|
@@ -1,68 +1,36 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
<component
|
|
3
|
+
class="mapo-field"
|
|
4
|
+
:class="classes"
|
|
5
|
+
:is="is"
|
|
6
|
+
v-model="model"
|
|
7
|
+
v-bind="fieldAttrs"
|
|
8
|
+
>
|
|
9
|
+
<template v-for="(_, slot) in $slots" :slot="slot">
|
|
10
|
+
<!-- @vuese-ignore -->
|
|
11
|
+
<slot :name="slot"></slot>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-for="(_, slot) in $scopedSlots" v-slot:[slot]="props">
|
|
14
|
+
<!-- @vuese-ignore -->
|
|
15
|
+
<slot :name="slot" v-bind="props" />
|
|
16
|
+
</template>
|
|
17
|
+
</component>
|
|
15
18
|
</template>
|
|
16
19
|
|
|
17
|
-
<style>
|
|
18
|
-
.mapo-label {
|
|
19
|
-
display: none;
|
|
20
|
-
}
|
|
21
|
-
</style>
|
|
22
|
-
|
|
23
20
|
<script>
|
|
24
|
-
import wygEditor from "@mapomodule/uikit/components/Form/fields/wygEditor/wygEditor.vue";
|
|
25
|
-
import DateField from "@mapomodule/uikit/components/Form/fields/DateField.vue";
|
|
26
|
-
import FksField from "@mapomodule/uikit/components/Form/fields/FksField.vue";
|
|
27
|
-
import MediaM2mField from "@mapomodule/uikit/components/Form/fields/MediaM2mField.vue";
|
|
28
|
-
import MediaField from "@mapomodule/uikit/components/Form/fields/MediaField.vue";
|
|
29
|
-
import EnhancedMediaField from "@mapomodule/uikit/components/Form/fields/EnhancedMediaField.vue";
|
|
30
|
-
|
|
31
|
-
import SeoPreview from "@mapomodule/uikit/components/Form/fields/SeoPreview.vue";
|
|
32
|
-
import FileField from "@mapomodule/uikit/components/Form/fields/FileField.vue";
|
|
33
|
-
import Repeater from "@mapomodule/uikit/components/Form/fields/Repeater.vue"
|
|
34
|
-
|
|
35
21
|
import { getPointed, setPointed } from "@mapomodule/utils/helpers/objHelpers";
|
|
36
22
|
import { titleCase } from "@mapomodule/utils/helpers/formatters";
|
|
37
23
|
|
|
38
24
|
import defaults from "./defaults";
|
|
39
25
|
import { debounce } from "@mapomodule/utils/helpers/debounce";
|
|
26
|
+
const _ = require("lodash");
|
|
40
27
|
|
|
41
28
|
/**
|
|
42
29
|
* This is mainly an internal component. It is used by the [`DetailComponent`](/components/detail/Detail/) in order to render dinamic fields inside the main form.
|
|
43
30
|
*/
|
|
44
31
|
export default {
|
|
45
32
|
name: "FormField",
|
|
46
|
-
|
|
47
|
-
wygEditor,
|
|
48
|
-
DateField,
|
|
49
|
-
FksField,
|
|
50
|
-
MediaM2mField,
|
|
51
|
-
MediaField,
|
|
52
|
-
EnhancedMediaField,
|
|
53
|
-
SeoPreview,
|
|
54
|
-
FileField,
|
|
55
|
-
Repeater,
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
data() {
|
|
59
|
-
return {
|
|
60
|
-
model: null,
|
|
61
|
-
defaultMap: defaults.mapping,
|
|
62
|
-
defaultAttrs: defaults.props,
|
|
63
|
-
defaultAccess: defaults.accessor,
|
|
64
|
-
};
|
|
65
|
-
},
|
|
33
|
+
data() { return { model: null, }; },
|
|
66
34
|
props: {
|
|
67
35
|
// V-model of the payload needed to edit the field value in realtime.
|
|
68
36
|
value: {
|
|
@@ -81,9 +49,9 @@ export default {
|
|
|
81
49
|
},
|
|
82
50
|
langs: {
|
|
83
51
|
type: Array,
|
|
84
|
-
default: () => []
|
|
52
|
+
default: () => [],
|
|
85
53
|
},
|
|
86
|
-
currentLang: String
|
|
54
|
+
currentLang: String,
|
|
87
55
|
},
|
|
88
56
|
watch: {
|
|
89
57
|
value: {
|
|
@@ -107,42 +75,70 @@ export default {
|
|
|
107
75
|
debouncedSetValue: debounce(function (...args) {
|
|
108
76
|
this.setValue(...args);
|
|
109
77
|
}, 300),
|
|
110
|
-
setValue(val){
|
|
78
|
+
setValue(val) {
|
|
111
79
|
const dump = { ...this.value }; // since we cannot directly edit a prop
|
|
112
|
-
setPointed(
|
|
113
|
-
|
|
114
|
-
this.kpointed,
|
|
115
|
-
this.accessor.set({ model: dump, val })
|
|
116
|
-
);
|
|
117
|
-
if (typeof this.conf.onChange == "function")
|
|
80
|
+
setPointed(dump, this.kpointed, this.accessor.set({ model: dump, val }));
|
|
81
|
+
if (typeof this.conf.onChange == "function")
|
|
118
82
|
this.conf.onChange({
|
|
119
83
|
val,
|
|
120
84
|
model: dump,
|
|
121
85
|
currentLang: this.currentLang,
|
|
122
86
|
languages: this.langs,
|
|
123
87
|
conf: this.conf,
|
|
124
|
-
kpointed: this.kpointed
|
|
125
|
-
})
|
|
88
|
+
kpointed: this.kpointed,
|
|
89
|
+
});
|
|
126
90
|
|
|
127
91
|
// Fired when the v-model changes.
|
|
128
92
|
// @arg Emits the entire payload modified.
|
|
129
93
|
this.$emit("input", dump);
|
|
130
94
|
},
|
|
131
|
-
extractValue(val = this.value){
|
|
95
|
+
extractValue(val = this.value) {
|
|
132
96
|
return this.accessor.get({
|
|
133
97
|
model: { ...val },
|
|
134
98
|
val: getPointed({ ...val }, this.kpointed),
|
|
135
99
|
});
|
|
136
100
|
},
|
|
137
101
|
setModel(val = this.value) {
|
|
138
|
-
var model = this.extractValue(val)
|
|
102
|
+
var model = this.extractValue(val);
|
|
139
103
|
if (val && JSON.stringify(this.model) !== JSON.stringify(model))
|
|
140
104
|
this.model = model;
|
|
141
105
|
},
|
|
142
106
|
},
|
|
143
107
|
computed: {
|
|
144
|
-
|
|
145
|
-
|
|
108
|
+
componentInfo() {
|
|
109
|
+
const originalName = this.is?.options?.name || this.is?.name || this.is;
|
|
110
|
+
const camelName = originalName.replace(/-./g, (x) => x[1].toUpperCase());
|
|
111
|
+
const kebabName = originalName.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
112
|
+
return { originalName, camelName, kebabName }
|
|
113
|
+
},
|
|
114
|
+
options(){
|
|
115
|
+
return _.merge(defaults, this.$mapo.$options?.ui?.forms?.fields);
|
|
116
|
+
},
|
|
117
|
+
defaultAccess() {
|
|
118
|
+
return this.options.accessor[this.componentInfo.camelName] || this.options.accessor[this.componentInfo.kebabName];
|
|
119
|
+
},
|
|
120
|
+
defaultAttrs() {
|
|
121
|
+
const componentAttrs = this.options.attrs[this.componentInfo.camelName] || this.options.attrs[this.componentInfo.kebabName];
|
|
122
|
+
return {...componentAttrs, ...this.options.attrs.All};
|
|
123
|
+
},
|
|
124
|
+
classes() {
|
|
125
|
+
var upperClasses = this.fieldAttrs.class;
|
|
126
|
+
if (typeof upperClasses == "string") {
|
|
127
|
+
upperClasses = { [upperClasses]: true };
|
|
128
|
+
} else if (Array.isArray(upperClasses)) {
|
|
129
|
+
upperClasses = upperClasses.reduce(
|
|
130
|
+
(acc, next) => ({ ...acc, [next]: true }),
|
|
131
|
+
{}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
...upperClasses,
|
|
136
|
+
[`mapo-field-${this.conf.value}`]: true,
|
|
137
|
+
"mapo-field--has-errors": this.hasErrors,
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
kpointed() {
|
|
141
|
+
let kpointed = this.conf.value;
|
|
146
142
|
if (this.currentLang && !this.conf.synci18n) {
|
|
147
143
|
const base = `translations.${this.currentLang}`;
|
|
148
144
|
kpointed = kpointed ? `${base}.${kpointed}` : base;
|
|
@@ -156,29 +152,33 @@ export default {
|
|
|
156
152
|
return {
|
|
157
153
|
get: func,
|
|
158
154
|
set: func,
|
|
159
|
-
...
|
|
155
|
+
...this.defaultAccess,
|
|
160
156
|
...this.conf.accessor,
|
|
161
157
|
};
|
|
162
158
|
},
|
|
159
|
+
errorMessages() {
|
|
160
|
+
return this.kpointed
|
|
161
|
+
.split(".")
|
|
162
|
+
.map((_, i, a) => a.slice(0, i + 1).join("."))
|
|
163
|
+
.reduce((acc, next) => {
|
|
164
|
+
const error = getPointed(this.errors || {}, next, []);
|
|
165
|
+
if (Array.isArray(error)) {
|
|
166
|
+
acc = [...acc, ...error];
|
|
167
|
+
} else if (typeof error == "string") {
|
|
168
|
+
acc = [...acc, error];
|
|
169
|
+
}
|
|
170
|
+
return acc;
|
|
171
|
+
}, []);
|
|
172
|
+
},
|
|
173
|
+
hasErrors() {
|
|
174
|
+
return !!this.errorMessages.length;
|
|
175
|
+
},
|
|
163
176
|
fieldAttrs() {
|
|
164
177
|
return {
|
|
165
178
|
label: this.label,
|
|
166
|
-
errorMessages: this.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
.reduce((acc, next) => {
|
|
170
|
-
const error = getPointed(this.errors || {}, next, []);
|
|
171
|
-
if (Array.isArray(error)) {
|
|
172
|
-
acc = [...acc, ...error];
|
|
173
|
-
} else if (typeof error == "string") {
|
|
174
|
-
acc = [...acc, error];
|
|
175
|
-
}
|
|
176
|
-
return acc;
|
|
177
|
-
}, []),
|
|
178
|
-
...this.defaultAttrs.All,
|
|
179
|
-
...(this.defaultAttrs[
|
|
180
|
-
this.is.replace(/-./g, (x) => x[1].toUpperCase())
|
|
181
|
-
] || {}),
|
|
179
|
+
errorMessages: this.errorMessages,
|
|
180
|
+
hideDetails: this.hasErrors,
|
|
181
|
+
...this.defaultAttrs,
|
|
182
182
|
readonly: this.readonly,
|
|
183
183
|
...this.conf.attrs,
|
|
184
184
|
currentLang: this.currentLang,
|
|
@@ -198,15 +198,16 @@ export default {
|
|
|
198
198
|
);
|
|
199
199
|
},
|
|
200
200
|
is() {
|
|
201
|
+
const dynImport = typeof this.conf.is == "string" && this.options.components[this.conf.is.replace(/-./g, (x) => x[1].toUpperCase())];
|
|
201
202
|
return (
|
|
202
|
-
this.conf.is ||
|
|
203
|
-
(this.conf.type && this.
|
|
204
|
-
|
|
203
|
+
dynImport || this.conf.is ||
|
|
204
|
+
(this.conf.type && this.options.mapping[this.conf.type]) ||
|
|
205
|
+
this.options.mapping.text
|
|
205
206
|
);
|
|
206
207
|
},
|
|
207
208
|
},
|
|
208
|
-
mounted(){
|
|
209
|
-
this.setModel()
|
|
210
|
-
}
|
|
209
|
+
mounted() {
|
|
210
|
+
this.setModel();
|
|
211
|
+
},
|
|
211
212
|
};
|
|
212
|
-
</script>
|
|
213
|
+
</script>
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-card v-if="conf" v-show="show(conf.group)" class="my-2 rounded-0 elevation-0 group-card">
|
|
3
|
-
<v-card-title :class="conf.group.titleClass">
|
|
3
|
+
<v-card-title class="text--secondary" :class="conf.group.titleClass">
|
|
4
4
|
<slot name="title.before" v-bind="slotBindings" />
|
|
5
5
|
<slot name="title" v-bind="slotBindings">
|
|
6
6
|
<v-icon left> {{ conf.group.icon }} </v-icon>
|
|
7
7
|
<span>{{ conf.group.name }}</span>
|
|
8
8
|
</slot>
|
|
9
9
|
<slot name="title.after" v-bind="slotBindings" />
|
|
10
|
+
<slot name="expandIcon" v-bind="slotBindings">
|
|
11
|
+
<v-icon class="expand-icon" :style="rotate" @click="expanded = !expanded"> mdi-chevron-up </v-icon>
|
|
12
|
+
</slot>
|
|
10
13
|
</v-card-title>
|
|
11
|
-
<div class="container">
|
|
14
|
+
<div v-if="expanded" class="container">
|
|
12
15
|
<Form
|
|
13
16
|
v-model="model"
|
|
14
17
|
v-bind="{ currentLang, errors, languages, readonly }"
|
|
@@ -29,9 +32,29 @@
|
|
|
29
32
|
</v-card>
|
|
30
33
|
</template>
|
|
31
34
|
<style lang="scss" scoped>
|
|
35
|
+
.expand-icon{
|
|
36
|
+
margin: 0 0 0 auto;
|
|
37
|
+
}
|
|
32
38
|
.theme--light .group-card {
|
|
33
39
|
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
34
40
|
}
|
|
41
|
+
.group-card .v-card__title{
|
|
42
|
+
padding: 6px 16px;
|
|
43
|
+
background: #0000002b;
|
|
44
|
+
position: relative;
|
|
45
|
+
&::after{
|
|
46
|
+
content: '';
|
|
47
|
+
position: absolute;
|
|
48
|
+
background: var(--v-primary-base);
|
|
49
|
+
height: 100%;
|
|
50
|
+
width: 4px;
|
|
51
|
+
left: 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
.theme--light .v-card__title{
|
|
55
|
+
background: #ffffff;
|
|
56
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
|
|
57
|
+
}
|
|
35
58
|
</style>
|
|
36
59
|
<script>
|
|
37
60
|
export default {
|
|
@@ -39,6 +62,7 @@ export default {
|
|
|
39
62
|
data() {
|
|
40
63
|
return {
|
|
41
64
|
model: {},
|
|
65
|
+
expanded: true
|
|
42
66
|
};
|
|
43
67
|
},
|
|
44
68
|
props: {
|
|
@@ -88,6 +112,12 @@ export default {
|
|
|
88
112
|
...this.moreSlotBindings,
|
|
89
113
|
};
|
|
90
114
|
},
|
|
115
|
+
rotate() {
|
|
116
|
+
return {
|
|
117
|
+
transform: this.expanded ? "rotate(180deg)" : "rotate(0deg)",
|
|
118
|
+
transition: "transform 225ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
119
|
+
};
|
|
120
|
+
},
|
|
91
121
|
},
|
|
92
122
|
methods: {
|
|
93
123
|
show(conf, type = "display"){
|
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
<span>{{ conf.group.name }}</span>
|
|
8
8
|
</slot>
|
|
9
9
|
<slot name="title.after" v-bind="slotBindings" />
|
|
10
|
+
<slot name="expandIcon" v-bind="slotBindings">
|
|
11
|
+
<v-icon class="expand-icon" :style="rotate" @click="expanded = !expanded"> mdi-chevron-up </v-icon>
|
|
12
|
+
</slot>
|
|
10
13
|
</v-card-title>
|
|
11
|
-
<div class="container">
|
|
14
|
+
<div v-if="expanded" class="container">
|
|
12
15
|
<v-tabs v-model="tabIndex" class="tab-wrapper">
|
|
13
16
|
<v-tab v-for="(tab, index) in conf.tabs" :key="index" v-show="show(tab)">
|
|
14
17
|
<v-badge :value="hasErrors(tab)" color="error" dot>
|
|
@@ -50,12 +53,33 @@
|
|
|
50
53
|
</template>
|
|
51
54
|
|
|
52
55
|
<style lang="scss" scoped>
|
|
56
|
+
.expand-icon{
|
|
57
|
+
margin: 0 0 0 auto;
|
|
58
|
+
}
|
|
53
59
|
.tab-wrapper {
|
|
54
60
|
margin: -12px 0 0 -12px;
|
|
55
61
|
}
|
|
56
62
|
.theme--light .tabs-card {
|
|
57
63
|
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
58
64
|
}
|
|
65
|
+
.tabs-card .v-card__title{
|
|
66
|
+
padding: 6px 16px;
|
|
67
|
+
background: #0000002b;
|
|
68
|
+
position: relative;
|
|
69
|
+
&::after{
|
|
70
|
+
content: '';
|
|
71
|
+
position: absolute;
|
|
72
|
+
background: var(--v-primary-base);
|
|
73
|
+
height: 100%;
|
|
74
|
+
width: 4px;
|
|
75
|
+
left: 0;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
.theme--light .v-card__title{
|
|
79
|
+
background: #ffffff;
|
|
80
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
|
|
81
|
+
}
|
|
82
|
+
|
|
59
83
|
</style>
|
|
60
84
|
<script>
|
|
61
85
|
import { findPropPaths } from "@mapomodule/utils/helpers/objHelpers";
|
|
@@ -67,6 +91,7 @@ export default {
|
|
|
67
91
|
return {
|
|
68
92
|
model: {},
|
|
69
93
|
tabIndex: 0,
|
|
94
|
+
expanded: true,
|
|
70
95
|
};
|
|
71
96
|
},
|
|
72
97
|
props: {
|
|
@@ -125,6 +150,12 @@ export default {
|
|
|
125
150
|
this.conf.group.icon
|
|
126
151
|
);
|
|
127
152
|
},
|
|
153
|
+
rotate() {
|
|
154
|
+
return {
|
|
155
|
+
transform: this.expanded ? "rotate(180deg)" : "rotate(0deg)",
|
|
156
|
+
transition: "transform 225ms cubic-bezier(0.4, 0, 0.2, 1)",
|
|
157
|
+
};
|
|
158
|
+
},
|
|
128
159
|
},
|
|
129
160
|
methods: {
|
|
130
161
|
nameSpacedSlots,
|