@mapomodule/uikit 1.0.0-alpha.5 → 1.0.0-alpha.9

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/components/Detail/Detail.vue +182 -105
  3. package/components/Detail/DetailField.vue +42 -29
  4. package/components/Detail/DetailLangSwitch.vue +1 -1
  5. package/components/Detail/defaults.js +32 -25
  6. package/components/DropArea.vue +3 -3
  7. package/components/List/List.vue +77 -42
  8. package/components/List/ListActions.vue +19 -1
  9. package/components/List/ListFilters.vue +127 -113
  10. package/components/List/ListHead.vue +30 -12
  11. package/components/List/ListQuickEdit.vue +198 -55
  12. package/components/List/ListTable.vue +138 -58
  13. package/components/Login.vue +14 -5
  14. package/components/MediaManager/MediaEditor.vue +253 -107
  15. package/components/MediaManager/MediaFolders.vue +125 -41
  16. package/components/MediaManager/MediaGallery.vue +56 -52
  17. package/components/MediaManager/MediaManager.vue +114 -74
  18. package/components/MediaManager/MediaManagerDialog.vue +19 -22
  19. package/components/MediaManager/MediaPreview.vue +180 -0
  20. package/components/MediaManager/MediaUploader.vue +35 -32
  21. package/components/SnackBar.vue +3 -4
  22. package/components/fields/DateField.vue +9 -3
  23. package/components/fields/FksField.vue +60 -0
  24. package/components/fields/MediaField.vue +24 -6
  25. package/components/fields/MediaM2mField.vue +8 -3
  26. package/components/fields/SeoPreview.vue +89 -0
  27. package/components/fields/{TinyMce → wygEditor}/defaults.js +1 -1
  28. package/components/fields/{TinyMce → wygEditor}/utils/events.js +0 -0
  29. package/components/fields/{TinyMce → wygEditor}/utils/mapomedia.plugin.js +0 -0
  30. package/components/fields/{TinyMce → wygEditor}/utils/script.injector.js +0 -0
  31. package/components/fields/{TinyMce/TinyMce.vue → wygEditor/wygEditor.vue} +40 -21
  32. package/components/layout/Sidebar/Sidebar.vue +46 -24
  33. package/components/layout/Sidebar/SidebarFooter.vue +42 -46
  34. package/components/layout/Sidebar/SidebarList.vue +13 -14
  35. package/components/layout/Sidebar/SidebarListItem.vue +81 -38
  36. package/components/layout/Topbar/Topbar.vue +3 -36
  37. package/components/layout/routebuilder.js +1 -1
  38. package/layouts/default.vue +3 -14
  39. package/package.json +3 -3
  40. package/pages/index.vue +0 -1
  41. package/components/fields/M2mField.vue +0 -95
package/CHANGELOG.md CHANGED
@@ -3,6 +3,154 @@
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.9](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2022-02-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **datefield:** graphic fix for datefield ([2cf2a8f](https://github.com/lotrekagency/mapo/commit/2cf2a8fe4a18717c6a1b1589e9fbc10273399fb5))
12
+ * **fksfield:** added fks alias to field ([d5b5ecf](https://github.com/lotrekagency/mapo/commit/d5b5ecf9f7bc7b270a8a2f22940281ef8453fb78))
13
+
14
+
15
+ ### Features
16
+
17
+ * **detail:** added possibility to remove group icon in detail field configuration ([a8f63e0](https://github.com/lotrekagency/mapo/commit/a8f63e00a03b5467db057f6ab813621e480eaeae))
18
+ * **detailfield:** added hidden label to simplify external graphic personalization of fields ([4e1de0d](https://github.com/lotrekagency/mapo/commit/4e1de0d9a256241ce010daaf058b6282c7279808))
19
+
20
+
21
+
22
+
23
+
24
+ # [1.0.0-alpha.8](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2022-01-23)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **detail:** fix lang switch crop in small devices ([fc05f1e](https://github.com/lotrekagency/mapo/commit/fc05f1e437c8c9318354a95c9edd19fb12e0cff9))
30
+ * **detailfield:** fix default prop handling ([b3297f1](https://github.com/lotrekagency/mapo/commit/b3297f10a1ca2bf8db1690c6dcf680baaf96f71b))
31
+ * **langs:** fixed lang detection from model api ([1653740](https://github.com/lotrekagency/mapo/commit/165374080e91571e89b1fc48f43983b681b1ffc0))
32
+ * **list:** remove quickadd if user cannot add ([aef919e](https://github.com/lotrekagency/mapo/commit/aef919ee94c71475b812378126369233df09d055))
33
+ * **login:** fix bad handling of login call ([2d73570](https://github.com/lotrekagency/mapo/commit/2d73570720c91cf8922ed750adeb8cf7f89360c7))
34
+ * **m2m:** let v-model be an object to let field manage fk ([5500870](https://github.com/lotrekagency/mapo/commit/550087025235adf5016ea9340090b3ce1278e126))
35
+ * **mediamanager:** fix linked models ([35611ed](https://github.com/lotrekagency/mapo/commit/35611ed104643c72d5317beef3349928eed09ee8))
36
+ * **permissions:** collect route middleware info directly from ([e1937cc](https://github.com/lotrekagency/mapo/commit/e1937cc835cd4d331a43c4bbf9581c16bfc03f41))
37
+ * **quickedit:** fix close button position ([8e15d47](https://github.com/lotrekagency/mapo/commit/8e15d47c6dd69dfbb2cbf3f70f2fb342202bf9a2))
38
+ * **quickedit:** temporary disable patch diff to fix translation problems ([1ec4b04](https://github.com/lotrekagency/mapo/commit/1ec4b04723d2d25ffdabfb5e5e69dd7c66735fe4))
39
+ * **sidebar:** fix footer menu auth ([6a986ba](https://github.com/lotrekagency/mapo/commit/6a986ba6def87a341e2bf670278716811336c725))
40
+ * **snackbar:** fix snack color ([9fcc053](https://github.com/lotrekagency/mapo/commit/9fcc053a1a52c3970706dcb4393be3aec0aa8c55))
41
+ * fix m2mfield for null values ([fbdf045](https://github.com/lotrekagency/mapo/commit/fbdf0456660b4cc6f46ac7d0ca40278451e87059))
42
+ * **uikit:** fix color mismatch in some components ([06cc23c](https://github.com/lotrekagency/mapo/commit/06cc23c8835c891e9ff15d277ba8bc4e54f1b8b8))
43
+
44
+
45
+ ### Features
46
+
47
+ * **detail:** added permission logics to detail component ([475d063](https://github.com/lotrekagency/mapo/commit/475d063ac1979380ec64afc057786a6b2ec142ba))
48
+ * **detail:** added permission logics to list actions component ([eebe25a](https://github.com/lotrekagency/mapo/commit/eebe25a8e0ef6f7d89dd7e1eca762d65ecc090a0))
49
+ * **detail:** added permission logics to list component ([83343ca](https://github.com/lotrekagency/mapo/commit/83343ca4038002d4528de0ec5d746c4420d5d157))
50
+ * **detail:** added permission logics to list head component ([95a37a2](https://github.com/lotrekagency/mapo/commit/95a37a2139726eed85824cf425dd15022d37bf88))
51
+ * **detail:** show backend error messages on model update ([a456a81](https://github.com/lotrekagency/mapo/commit/a456a81610b7b95e231f33cc35f2c87fb9a80071))
52
+ * **fields:** added readonly prop to date custom field ([682bab5](https://github.com/lotrekagency/mapo/commit/682bab59ce88a0dbfa1be644103ccf8b0cb6bf41))
53
+ * **fields:** added readonly prop to various custom fields ([ed45190](https://github.com/lotrekagency/mapo/commit/ed45190cec6250bb26e91b26dc570e07e0fd800c))
54
+ * **m2m:** added autocomplete by default ([1956427](https://github.com/lotrekagency/mapo/commit/19564271f71a289d840a3e1200098e911935da4f))
55
+ * **m2m:** autodisable chips if multiple = false ([5dcc88d](https://github.com/lotrekagency/mapo/commit/5dcc88d671b4c06bd378573a27c9bc1b44b4b736))
56
+ * **m2m:** restyle m2m field ([bb49f3d](https://github.com/lotrekagency/mapo/commit/bb49f3dbf9ba3d6fb2a78e69113645fdde2e1cce))
57
+ * **M2m:** added max height ([d32a383](https://github.com/lotrekagency/mapo/commit/d32a3831f903d20924408536b2921fba3f5e683e))
58
+ * **quickedit:** add close button on hover ([c365f51](https://github.com/lotrekagency/mapo/commit/c365f515dbb2edbf9d964c63b170bf3247309d70))
59
+ * **quickedit:** added non field errors ([4b63e73](https://github.com/lotrekagency/mapo/commit/4b63e734818a0d690831c39ccbe73403400dffd4))
60
+ * **quickedit:** merge detail component logics in to quickedit ([691f610](https://github.com/lotrekagency/mapo/commit/691f610b156f58a5d30598d89bf06425d90451d8))
61
+ * **sidebar:** hide not navigable entries depending on user permissions ([349dd6c](https://github.com/lotrekagency/mapo/commit/349dd6c102cdf80d25de4db988f1ccf29047dfcd))
62
+ * **uikit:** more consistent ui style ([54c464f](https://github.com/lotrekagency/mapo/commit/54c464f0c8ea86d87e5ae2004b7744bb4126ebba))
63
+
64
+
65
+
66
+
67
+
68
+ # [1.0.0-alpha.7](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2022-01-13)
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * **detail:** fix v-card content margin on detail component ([f07d5c1](https://github.com/lotrekagency/mapo/commit/f07d5c1581e71407e79fce95c8dc10109196ed0b))
74
+ * **detail:** remove lang swtch if only one lang is selected ([35cf58a](https://github.com/lotrekagency/mapo/commit/35cf58aa17ce4350f983643a8182fdf795dd4abb))
75
+ * **detail:** remove v-container from detail component to fix sizing ([2947652](https://github.com/lotrekagency/mapo/commit/29476528a6c13325c4da49a3e2aa842302e6bd04))
76
+ * **list:** fix search box for very small displays ([edf7287](https://github.com/lotrekagency/mapo/commit/edf7287c6974b8bb1412d9e0fb8bc4b1f1b48480))
77
+ * **media:** fix reset on media dialog ([3727502](https://github.com/lotrekagency/mapo/commit/3727502b59c9fa809b4dbc139b0cd01198008a18))
78
+ * **media:** reset media dialog after close ([5aded79](https://github.com/lotrekagency/mapo/commit/5aded794dbfb5482119db45bfb975e7241f86f15))
79
+ * **mediamanager:** better display of folder path in media manager ([bdc5692](https://github.com/lotrekagency/mapo/commit/bdc569264164e61af1c210aeb1c5da9d5b21220a))
80
+ * **mediamanager:** better ui for selection ([2307d38](https://github.com/lotrekagency/mapo/commit/2307d38a5a4e0fe838b5f9173692e132fe69e3be))
81
+ * **mediamanager:** fix backbutton background in media editor ([315d9df](https://github.com/lotrekagency/mapo/commit/315d9df2a9021ee1ea1328b4d959f0fd5f652f47))
82
+ * **mediamanager:** fix corb errors loading image preview in mediamanager ([7f34e34](https://github.com/lotrekagency/mapo/commit/7f34e34dfdfe4380d1704c0c8dda0a507676aeae))
83
+ * **mediamanager:** fix DOMException: The play() request was interrupted ([89a2a3e](https://github.com/lotrekagency/mapo/commit/89a2a3e1bb47178245ca7d131bdfedbcbcc41c17))
84
+ * **mediamanager:** fix editor opening ([3888652](https://github.com/lotrekagency/mapo/commit/3888652b0441cd17f0468db57fd895afd97a3625))
85
+ * **mediamanager:** make editing animation smooth ([81bd34b](https://github.com/lotrekagency/mapo/commit/81bd34b04d0d561317a1928dcdc796adc539350b))
86
+ * **mediamanager:** minor fixes to mediamanager ui ([a7b6089](https://github.com/lotrekagency/mapo/commit/a7b6089c38af9a6079bd8bebfeddd2dcff0b2c75))
87
+ * **mediamanager:** prevent media type check fail if no media type present ([2ee88fe](https://github.com/lotrekagency/mapo/commit/2ee88fed81d527434cf854e68ff8210247b2cf39))
88
+ * **mediamanagerdialog:** better positioning on small device of media manager dialog content ([9da147c](https://github.com/lotrekagency/mapo/commit/9da147c7e2d356da7f74e2edcbf05c5dafcbd94d))
89
+ * **sidebar:** fix nested SidebarListItems not triggering active class when the list-item is not a link ([9e92971](https://github.com/lotrekagency/mapo/commit/9e929710e74946c1470c29c007d780a1e712170b))
90
+ * **tinymce:** added missing al text to image tag ([55a3926](https://github.com/lotrekagency/mapo/commit/55a39261b3e449381d974eaa1b328a46dffb6f51))
91
+ * **uikit:** fix some content disposition in main layout ([1e9c79b](https://github.com/lotrekagency/mapo/commit/1e9c79b6b80d781c5aded10800c9df255b6ef8e8))
92
+
93
+
94
+ ### Features
95
+
96
+ * **media:** added mime type filtering ([da01658](https://github.com/lotrekagency/mapo/commit/da016585d450143f6419d98a7f53ee5ec8cf7358))
97
+ * **media:** added search input ([a1ac6ae](https://github.com/lotrekagency/mapo/commit/a1ac6aef8d28a248431cd80955c5a1446f41f608))
98
+ * **media:** selection prop 2-way binded ([e87f21c](https://github.com/lotrekagency/mapo/commit/e87f21c085e0cf0a61a99025d9f5e7970285ab72))
99
+ * **mediafield:** update media field to handle files ([5158108](https://github.com/lotrekagency/mapo/commit/51581086d96e09af31471721f0ea32df3fe58e09))
100
+ * **mediamanager:** added audio playback for audio files ([6aec9f7](https://github.com/lotrekagency/mapo/commit/6aec9f7b749c5002832fd194d565742b99a4b700))
101
+ * **mediamanager:** added icon for media that are not images ([d77f17b](https://github.com/lotrekagency/mapo/commit/d77f17b2d77db7bf4dc387be0b6d3892a4772b02))
102
+ * **mediamanager:** added link to img shortcut button in editor ([1dd446f](https://github.com/lotrekagency/mapo/commit/1dd446f76df1d3a7e71fdefb81ad60de1fdb4e93))
103
+ * **mediamanager:** added the possibility to change the media file using same url of the old file ([f21f383](https://github.com/lotrekagency/mapo/commit/f21f383b6f3f0176f806688a50ebff93a53d3203))
104
+ * **mediamanager:** added video preview for video mime types ([55fc423](https://github.com/lotrekagency/mapo/commit/55fc423c03265fb2c17bc42f1be0ba511928267c))
105
+ * **mediamanager:** many ui enhancements for mediamanager ([30ab3ff](https://github.com/lotrekagency/mapo/commit/30ab3ff89dc0ff3b9a210cfd32e2a874dfc073a6))
106
+ * **mediamanager:** media folders manager graphic enhancements ([0e8e7ec](https://github.com/lotrekagency/mapo/commit/0e8e7ec35482d043c42c88c38c9d32c8fa8e54e9))
107
+ * **sidebar:** added spidermenu for nested routes ([084029d](https://github.com/lotrekagency/mapo/commit/084029de717f29412b045fe703c4cfbd19353400))
108
+ * **tinymce:** added callback to manage video and documents insertions with mapomedia plugin ([b4e6f63](https://github.com/lotrekagency/mapo/commit/b4e6f6362e025010614e7ca8351a9d1e3af08650))
109
+
110
+
111
+
112
+
113
+
114
+ # [1.0.0-alpha.6](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2021-12-26)
115
+
116
+
117
+ ### Bug Fixes
118
+
119
+ * **uikit:** fix sidebar footer items not collapsing on mini variant ([04c510e](https://github.com/lotrekagency/mapo/commit/04c510ee87bd7b74161725c366e2eac2bd3efe9f))
120
+ * **uikit:** fix sidebar items not collapsing on mini variant ([67a9524](https://github.com/lotrekagency/mapo/commit/67a9524b17b6cbdf455b8e6f56f7cc0674b1dbed))
121
+ * various css fixes ([658c363](https://github.com/lotrekagency/mapo/commit/658c3636e869f0a2bd53efe41295cf87d6af3962))
122
+ * **list:** fix v-menu position on large screens ([41bd08d](https://github.com/lotrekagency/mapo/commit/41bd08d36d85e685a755c7e0de97bbb05a24c03d))
123
+ * **list:** fixed v-menu filter positioning ([e99848e](https://github.com/lotrekagency/mapo/commit/e99848e0beb2df124db1ba9968696bbe8ee7b683))
124
+ * **list:** fixed v-menu position for filters ([cb95260](https://github.com/lotrekagency/mapo/commit/cb9526085d536ff7b468316b1d2571c7ae9509d8))
125
+ * **list:** load page from query params ([88dea98](https://github.com/lotrekagency/mapo/commit/88dea98063cdab79c9c518fe0e3bf8d3c90f0161))
126
+ * **list:** refactoring for injected elements and FE pagination ([f9c968e](https://github.com/lotrekagency/mapo/commit/f9c968e0edf87654df60781d7d2d465d15e40ab9))
127
+ * **list:** removed lock to BE pagination if items in list are less than itemsPerPage ([3fe34e0](https://github.com/lotrekagency/mapo/commit/3fe34e0d1438a0980e8819070f9b158ad3b6e0b8))
128
+ * **uikit:** better handle detail component lang switches ([5297e49](https://github.com/lotrekagency/mapo/commit/5297e4956536b382600c250f5c797c8db5e58f84))
129
+ * **uikit:** fix detailfield not reading conf value changes ([5628268](https://github.com/lotrekagency/mapo/commit/5628268e4e78201523eba60adaf17286dfb38c8b))
130
+ * **uikit:** fix lang changhe in detail component ([32494f7](https://github.com/lotrekagency/mapo/commit/32494f7d094f7e9cebc14f7524ad716eb89fd6d7))
131
+ * **uikit:** fix positioning of element in list component and subcomponents ([887c3b6](https://github.com/lotrekagency/mapo/commit/887c3b6aae52d1a3494ebcc01f0f155f21373f9c))
132
+ * **uikit:** set endpoint to default null in detail field ([5c9296c](https://github.com/lotrekagency/mapo/commit/5c9296c81f8667319699e933f528c4c05a1f541d))
133
+ * fixed v-model with datepicker filter ([ef4634e](https://github.com/lotrekagency/mapo/commit/ef4634e8ad0719ec2991a8c40a87191c0e32d7ec))
134
+ * load saved date range into datepicker ([eb94dd5](https://github.com/lotrekagency/mapo/commit/eb94dd5686b9fed16e0f39bf122c767d8bd1017b))
135
+
136
+
137
+ ### Features
138
+
139
+ * **list:** added support to offline items ([495fd1f](https://github.com/lotrekagency/mapo/commit/495fd1f30cd0adc228b48ca4384b9df572e69216))
140
+ * **list:** handle multisort ([41feb88](https://github.com/lotrekagency/mapo/commit/41feb88ec15be5cc9afbcdf3d2dea23142301153))
141
+ * **uikit:** add possibility to remove icon from sidebar ([106d85f](https://github.com/lotrekagency/mapo/commit/106d85f576cdc9e6438b48fa8e695315cac2262b))
142
+ * **uikit:** added langChange event to detail component ([70d3430](https://github.com/lotrekagency/mapo/commit/70d3430694e67dfcd65539a3d474847123e05db5))
143
+ * **uikit:** added possibility to change detail component current lang fromprop ([1993aa7](https://github.com/lotrekagency/mapo/commit/1993aa74a66768eea319f41a41878916544adcbb))
144
+ * **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))
145
+ * **uikit:** added seopreview field ([03e52fe](https://github.com/lotrekagency/mapo/commit/03e52fed08e60c8b43226856a8d05d4c724ad9b2))
146
+ * **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))
147
+ * **uikit:** display errors on tinymce component also with red label shake animation ([2c9e158](https://github.com/lotrekagency/mapo/commit/2c9e158090ee1f770518ad755437171a1b16afbd))
148
+ * **uikit:** newsidebar built with vuetify components to better support theming ([9cc237f](https://github.com/lotrekagency/mapo/commit/9cc237fa7dcfe193edc0fd9cb90e3bbbb103931d))
149
+
150
+
151
+
152
+
153
+
6
154
  # [1.0.0-alpha.5](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2021-12-20)
7
155
 
8
156
 
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <v-container>
2
+ <div>
3
3
  <!-- Use this to override the title of the detail component. -->
4
4
  <slot name="title" v-bind="slotBindings">
5
5
  <!-- `<h1> "Create | Edit" + modelName </h1>` -->
6
- <v-row class="mb-14">
7
- <h1>{{ isNew ? "Create" : "Edit" }} {{ modelName }}</h1>
6
+ <v-row class="mb-5">
7
+ <v-col col="12"><h1 class="display-1">{{ isNew ? "Create" : "Edit" }} {{ modelName }}</h1></v-col>
8
8
  </v-row>
9
9
  </slot>
10
10
  <v-form ref="form">
@@ -16,7 +16,7 @@
16
16
  <slot name="body.lang" v-bind="slotBindings">
17
17
  <!-- [`DetailLangSwitch`](/components/detail/DetailLangSwitch/) -->
18
18
  <DetailLangSwitch
19
- v-if="langs && langs.length"
19
+ v-if="langs && langs.length > 1"
20
20
  class="mb-4"
21
21
  v-model="currentLang"
22
22
  :langs="langs"
@@ -26,47 +26,57 @@
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
- <!-- The result of the [`DetailConfiguration`](#detailconfiguration) contained in the main body. -->
30
- <div v-for="(field, index) in mainFields" :key="index">
31
- <v-card v-if="field.group" class="my-2">
32
- <v-card-title>
33
- <v-icon left> {{ field.group.icon }} </v-icon>
34
- <span>{{ field.group.name }}</span>
35
- </v-card-title>
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
- <DetailField v-model="model" :conf="field" :errors="errors" />
69
- </slot>
37
+ <v-card v-if="field.group" class="my-2 rounded-0">
38
+ <v-card-title>
39
+ <v-icon left> {{ field.group.icon }} </v-icon>
40
+ <span>{{ field.group.name }}</span>
41
+ </v-card-title>
42
+ <div class="container">
43
+ <div class="row">
44
+ <div
45
+ v-for="(fields, fieldsI) in field.fields"
46
+ :key="fieldsI"
47
+ class="col-12"
48
+ :class="fields.class"
49
+ >
50
+ <!-- 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`. -->
51
+ <slot
52
+ :name="fields.slotName"
53
+ v-bind="{
54
+ conf: fields,
55
+ ...slotBindings,
56
+ }"
57
+ >
58
+ <!-- A [`DetailField`](/components/detail/DetailField/) configured by a [`FieldConfiguration`](#fieldconfiguration). -->
59
+ <DetailField
60
+ v-model="model"
61
+ :conf="fields"
62
+ :errors="errors"
63
+ />
64
+ </slot>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </v-card>
69
+ <slot
70
+ v-else
71
+ :name="field.slotName"
72
+ v-bind="{
73
+ conf: field,
74
+ ...slotBindings,
75
+ }"
76
+ >
77
+ <DetailField v-model="model" :conf="field" :errors="errors" />
78
+ </slot>
79
+ </div>
70
80
  </div>
71
81
  </slot>
72
82
  <!-- Use this to add content under the main body. -->
@@ -83,14 +93,14 @@
83
93
  <!-- Use this to override the Save button. -->
84
94
  <slot name="button.save" v-bind="slotBindings">
85
95
  <!-- The Save button. -->
86
- <v-btn class="mb-2" tile block @click="saveItem(true)">{{
96
+ <v-btn :disabled="isReadonly" class="mb-2" tile block @click="saveItem(true)">{{
87
97
  isNew ? "Create" : "Save"
88
98
  }}</v-btn>
89
99
  </slot>
90
100
  <!-- Use this to override the Save and continue button. -->
91
101
  <slot name="button.savecontinue" v-bind="slotBindings">
92
102
  <!-- The Save and continue button. -->
93
- <v-btn class="mb-2" tile block @click="saveItem(false)"
103
+ <v-btn :disabled="isReadonly" class="mb-2" tile block @click="saveItem(false)"
94
104
  >{{ isNew ? "Create" : "Save" }} and continue</v-btn
95
105
  >
96
106
  </slot>
@@ -110,6 +120,7 @@
110
120
  color="error"
111
121
  tile
112
122
  block
123
+ :disabled="!canDelete"
113
124
  @click="deleteItem"
114
125
  >Delete</v-btn
115
126
  >
@@ -118,45 +129,55 @@
118
129
  </slot>
119
130
  <!-- Use this to add content on the top of the sidebar fields (or under sidebar buttons). -->
120
131
  <slot name="side.top" v-bind="slotBindings"></slot>
121
- <div v-for="(field, index) in sideFields" :key="index">
122
- <v-card v-if="field.group" class="mb-4">
123
- <v-card-title>
124
- <v-icon left> {{ field.group.icon }} </v-icon>
125
- <span>{{ field.group.name }}</span>
126
- </v-card-title>
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
- }"
132
+ <div class="row">
133
+ <div
134
+ class="col-12"
135
+ :class="field.class"
136
+ v-for="(field, index) in sideFields"
137
+ :key="index"
157
138
  >
158
- <DetailField v-model="model" :conf="field" :errors="errors" />
159
- </slot>
139
+ <v-card v-if="field.group" class="rounded-0 mb-4">
140
+ <v-card-title>
141
+ <v-icon left> {{ field.group.icon }} </v-icon>
142
+ <span>{{ field.group.name }}</span>
143
+ </v-card-title>
144
+ <div class="container">
145
+ <div class="row">
146
+ <div
147
+ v-for="(fields, fieldsI) in field.fields"
148
+ :key="fieldsI"
149
+ class="col-12"
150
+ :class="field.class"
151
+ >
152
+ <!-- @vuese-ignore -->
153
+ <slot
154
+ :name="fields.slotName"
155
+ v-bind="{
156
+ conf: fields,
157
+ ...slotBindings,
158
+ }"
159
+ >
160
+ <DetailField
161
+ v-model="model"
162
+ :conf="fields"
163
+ :errors="errors"
164
+ />
165
+ </slot>
166
+ </div>
167
+ </div>
168
+ </div>
169
+ </v-card>
170
+ <slot
171
+ v-else
172
+ :name="field.slotName"
173
+ v-bind="{
174
+ conf: field,
175
+ ...slotBindings,
176
+ }"
177
+ >
178
+ <DetailField v-model="model" :conf="field" :errors="errors" />
179
+ </slot>
180
+ </div>
160
181
  </div>
161
182
  <!-- Use this to add content under the sidebar fields. -->
162
183
  <slot name="side.bottom" v-bind="slotBindings"></slot>
@@ -164,7 +185,7 @@
164
185
  </v-col>
165
186
  </v-row>
166
187
  </v-form>
167
- </v-container>
188
+ </div>
168
189
  </template>
169
190
 
170
191
 
@@ -183,6 +204,16 @@ export default {
183
204
  };
184
205
  },
185
206
  props: {
207
+ // V-model of the object we are editing.
208
+ value: {
209
+ type: Object,
210
+ required: false
211
+ },
212
+ // Set the current lang to value.
213
+ lang: {
214
+ type: String,
215
+ required: false
216
+ },
186
217
  // The main configuration that determines the arrangement of the fields in the detail layout.
187
218
  fields: {
188
219
  // [`DetailConfiguration`](#detailconfiguration)
@@ -195,7 +226,10 @@ export default {
195
226
  default: () => []
196
227
  },
197
228
  // 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: String,
229
+ endpoint: {
230
+ type: String,
231
+ default: null
232
+ },
199
233
  // The identifier of the object you need to retrieve and edit. It can be "new" if you need to create a new payload.
200
234
  identifier: {
201
235
  // `String|Number`.
@@ -221,7 +255,7 @@ export default {
221
255
  this.errors =
222
256
  (error.response.status == 400 && error.response.data) || null;
223
257
  this.$mapo.$snack.open({
224
- message: "Something whent bad, please try again later...",
258
+ message: error.response?.data?.detail || "Something whent bad, please try again later...",
225
259
  color: "error"
226
260
  });
227
261
  });
@@ -231,7 +265,7 @@ export default {
231
265
  .open({
232
266
  title: "Delete",
233
267
  question: "Are you sure you want to delete this item?",
234
- approveButton: { text: "Delete", attrs: { color: "red" } }
268
+ approveButton: { text: "Delete", attrs: { color: "red", text: true } }
235
269
  })
236
270
  .then(res => {
237
271
  if (res) {
@@ -240,19 +274,32 @@ export default {
240
274
  .then(() => this.$router.back())
241
275
  .catch(error =>
242
276
  this.$mapo.$snack.open({
243
- message: "Something whent bad, please try again later...",
277
+ message: error.response?.data?.detail || "Something whent bad, please try again later...",
244
278
  color: "error"
245
279
  })
246
280
  );
247
281
  }
248
282
  });
249
283
  },
250
- parseConf(field) {
284
+ initLang(lang = this.currentLang) {
285
+ if (lang && !this.model.translations) {
286
+ this.model.translations = {};
287
+ }
288
+ if (lang && !this.model.translations[lang]) {
289
+ this.model.translations[lang] = {};
290
+ }
291
+ },
292
+ parseConf(field, i) {
251
293
  const conf = typeof field === "string" ? { value: field } : field;
252
- conf.value = conf.value.replace(/^translations\..*\./, "");
253
- conf.slotName = `fields.${conf.value}`;
294
+ conf.value = conf.value || "";
295
+ conf.value = conf.value.replace(new RegExp(`^translations\.(${this.langs.join("|")})\.?`), "");
296
+ conf.slotName = `fields.${conf.value || i}`;
254
297
  if (this.currentLang && !field.synci18n) {
255
- conf.value = `translations.${this.currentLang}.${conf.value}`;
298
+ const base = `translations.${this.currentLang}`;
299
+ conf.value = (conf.value && `${base}.${conf.value}`) || base;
300
+ }
301
+ if (this.isReadonly){
302
+ conf.attrs = {...conf.attrs, readonly: true}
256
303
  }
257
304
  return conf;
258
305
  },
@@ -261,21 +308,35 @@ export default {
261
308
  const parseGroup = group =>
262
309
  typeof group === "string"
263
310
  ? { name: group, icon }
264
- : { ...group, icon: group.icon || icon };
265
- return fields.map(f =>
311
+ : { ...group, icon: group.icon !== undefined ? group.icon : icon };
312
+ return fields.map((f, i) =>
266
313
  f.group
267
314
  ? { group: parseGroup(f.group), fields: this.mapConf(f.fields) }
268
- : this.parseConf(f)
315
+ : this.parseConf(f, i)
269
316
  );
270
317
  }
271
318
  },
272
319
  watch: {
273
320
  currentLang(val) {
274
- if (val && !this.model.translations) {
275
- this.model.translations = {};
321
+ this.initLang();
322
+ // Fired when the current language changes.
323
+ // @arg Emits the language name as a string.
324
+ this.$emit("update:lang", val);
325
+ },
326
+ model(val) {
327
+ // Fired when the v-model changes.
328
+ // @arg Emits the entire payload modified.
329
+ this.$emit("input", val);
330
+ },
331
+ lang(val) {
332
+ if (val && this.langs.includes(val)) {
333
+ this.currentLang = val;
276
334
  }
277
- if (val && !this.model.translations[val]) {
278
- this.model.translations[val] = {};
335
+ },
336
+ value(val) {
337
+ if (val) {
338
+ this.model = val;
339
+ this.initLang();
279
340
  }
280
341
  }
281
342
  },
@@ -283,6 +344,18 @@ export default {
283
344
  crud() {
284
345
  return this.$mapo.$api.crud(this.endpoint);
285
346
  },
347
+ isReadonly() {
348
+ if (this.$mapo.$auth.routeMiddlewares.includes("permissions")){
349
+ return !this.$mapo.$auth.user.permissions.includes(this.isNew ? "add" : "change")
350
+ }
351
+ return false
352
+ },
353
+ canDelete() {
354
+ if (this.$mapo.$auth.routeMiddlewares.includes("permissions")){
355
+ return this.$mapo.$auth.user.permissions.includes("delete")
356
+ }
357
+ return true
358
+ },
286
359
  mainFields() {
287
360
  return this.mapConf(
288
361
  this.fields instanceof Array ? this.fields : this.fields.main || []
@@ -304,7 +377,7 @@ export default {
304
377
  },
305
378
  langs() {
306
379
  return (
307
- this.model?.active_languages?.languages.map(l => l.id) || this.languages
380
+ this.model?.lang_info?.site_languages.map(l => l.id) || this.languages
308
381
  );
309
382
  },
310
383
  slotBindings() {
@@ -331,7 +404,10 @@ export default {
331
404
  },
332
405
  mounted() {
333
406
  if (this.identifier && this.identifier !== "new") {
334
- this.crud.detail(this.identifier).then(res => (this.model = res));
407
+ this.crud.detail(this.identifier).then(res => {
408
+ this.model = res;
409
+ this.initLang();
410
+ });
335
411
  }
336
412
  }
337
413
  };
@@ -383,10 +459,10 @@ Here the list of the FieldConfiguration type association.
383
459
  - `switch` ==> [v-switch](https://vuetifyjs.com/en/components/switches/),
384
460
  - `slider` ==> [v-slider](https://vuetifyjs.com/en/components/sliders/),
385
461
  - `file` ==> [v-file-input](https://vuetifyjs.com/en/components/file-inputs/),
386
- - `editor` ==> [tiny-mce](/components/fields/TinyMce/TinyMce/),
462
+ - `editor` ==> [wyg-editor](/components/fields/wygEditor/wygEditor/),
387
463
  - `media` ==> [media-field](/components/fields/MediaField/),
388
- - `m2m` ==> [m2m-field](/components/fields/M2mField/),
389
- - `mediaList` ==> [media-m2m-field](/components/fields/MediaM2mField/)
464
+ - `m2m` or `fks` ==> [fks-field](/components/fields/FksField/),
465
+ - `mediaList` ==> [media-fks-field](/components/fields/MediaM2mField/)
390
466
 
391
467
 
392
468
  #### Example of a [`FieldConfiguration`](#fieldconfiguration):
@@ -446,6 +522,7 @@ export default {
446
522
  "title",
447
523
  { value: "description", type: "textarea" },
448
524
  "permalink",
525
+ { type: "seoPreview" }
449
526
  ]
450
527
  }
451
528
  ],