@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.
Files changed (36) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/components/Detail/Detail.vue +59 -25
  3. package/components/Detail/DetailLangSwitch.vue +5 -0
  4. package/components/Form/Form.vue +4 -4
  5. package/components/Form/FormField.vue +90 -89
  6. package/components/Form/FormGroup.vue +32 -2
  7. package/components/Form/FormTabs.vue +32 -1
  8. package/components/Form/defaults.js +49 -18
  9. package/components/Form/fields/ColorField.vue +5 -2
  10. package/components/Form/fields/DateField.vue +7 -1
  11. package/components/Form/fields/MediaField.vue +5 -2
  12. package/components/Form/fields/MediaM2mField.vue +11 -6
  13. package/components/Form/fields/wygEditor/defaults.js +20 -52
  14. package/components/Form/fields/wygEditor/wygEditor.vue +48 -19
  15. package/components/List/ListTable.vue +1 -1
  16. package/components/MediaManager/MediaBreadcrumbs.vue +3 -2
  17. package/components/MediaManager/MediaFolders.vue +2 -41
  18. package/components/layout/Sidebar/Sidebar.vue +38 -10
  19. package/components/layout/Sidebar/SidebarList.vue +4 -6
  20. package/components/layout/Sidebar/SidebarListItem.vue +11 -0
  21. package/components/layout/Sidebar/SidebarTitle.vue +45 -0
  22. package/components/layout/Topbar/Topbar.vue +11 -10
  23. package/defaults/vuetify.js +8 -7
  24. package/package.json +2 -2
  25. package/static/{favicon.ico → mapo/favicon.ico} +0 -0
  26. package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
  27. package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
  28. package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
  29. package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
  30. package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
  31. package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
  32. package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
  33. package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
  34. package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
  35. package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
  36. package/components/layout/Sidebar/SidebarFooter.vue +0 -52
@@ -1,23 +1,54 @@
1
+ const components = {
2
+ // vuetify
3
+ vTextField: () => import("vuetify/lib/components/VTextField"),
4
+ vSelect: () => import("vuetify/lib/components/VSelect"),
5
+ vTextarea: () => import("vuetify/lib/components/VTextarea"),
6
+ vSwitch: () => import("vuetify/lib/components/VSwitch"),
7
+ vSlider: () => import("vuetify/lib/components/VSlider"),
8
+ vAutocomplete: () => import("vuetify/lib/components/VAutocomplete"),
9
+ vCheckbox: () => import("vuetify/lib/components/VCheckbox"),
10
+ vCombobox: () => import("vuetify/lib/components/VCombobox"),
11
+ vFileInput: () => import("vuetify/lib/components/VFileInput"),
12
+ vInput: () => import("vuetify/lib/components/VInput"),
13
+ vOtpInput: () => import("vuetify/lib/components/VOtpInput"),
14
+ vOverflowBtn: () => import("vuetify/lib/components/VOverflowBtn"),
15
+ vRangeSlider: () => import("vuetify/lib/components/VRangeSlider"),
16
+ vRating: () => import("vuetify/lib/components/VRating"),
17
+ vRadioGroup: () => import("vuetify/lib/components/VRadioGroup"),
18
+
19
+ // customs
20
+ wygEditor: () => import("@mapomodule/uikit/components/Form/fields/wygEditor/wygEditor.vue"),
21
+ DateField: () => import("@mapomodule/uikit/components/Form/fields/DateField.vue"),
22
+ FksField: () => import("@mapomodule/uikit/components/Form/fields/FksField.vue"),
23
+ MediaM2mField: () => import("@mapomodule/uikit/components/Form/fields/MediaM2mField.vue"),
24
+ MediaField: () => import("@mapomodule/uikit/components/Form/fields/MediaField.vue"),
25
+ EnhancedMediaField: () => import("@mapomodule/uikit/components/Form/fields/EnhancedMediaField.vue"),
26
+ SeoPreview: () => import("@mapomodule/uikit/components/Form/fields/SeoPreview.vue"),
27
+ FileField: () => import("@mapomodule/uikit/components/Form/fields/FileField.vue"),
28
+ Repeater: () => import("@mapomodule/uikit/components/Form/fields/Repeater.vue"),
29
+ ColorField: () => import("@mapomodule/uikit/components/Form/fields/ColorField.vue"),
30
+ }
31
+
1
32
  const mapping = {
2
- text: "vTextField",
3
- select: "vSelect",
4
- date: "DateField",
5
- textarea: "vTextarea",
6
- switch: "vSwitch",
7
- slider: "vSlider",
8
- file: "FileField",
9
- editor: "wygEditor",
10
- media: "MediaField",
11
- enhancedMedia: "EnhancedMediaField",
12
- fks: "FksField",
13
- m2m: "FksField",
14
- mediaList: "MediaM2mField",
15
- seoPreview: "SeoPreview",
16
- repeater: "Repeater",
17
- color: "ColorField"
33
+ text: components.vTextField,
34
+ select: components.vSelect,
35
+ date: components.DateField,
36
+ textarea: components.vTextarea,
37
+ switch: components.vSwitch,
38
+ slider: components.vSlider,
39
+ file: components.FileField,
40
+ editor: components.wygEditor,
41
+ media: components.MediaField,
42
+ enhancedMedia: components.EnhancedMediaField,
43
+ fks: components.FksField,
44
+ m2m: components.FksField,
45
+ mediaList: components.MediaM2mField,
46
+ seoPreview: components.SeoPreview,
47
+ repeater: components.Repeater,
48
+ color: components.ColorField,
18
49
  }
19
50
 
20
- const props = {
51
+ const attrs = {
21
52
  vSelect: {
22
53
  itemText: "text",
23
54
  itemValue: "value"
@@ -56,5 +87,5 @@ const accessor = {
56
87
  }
57
88
  }
58
89
  export default {
59
- mapping, props, accessor
90
+ mapping, attrs, accessor, components
60
91
  }
@@ -13,9 +13,9 @@
13
13
  readonly
14
14
  v-bind="{ ...$attrs, ...attrs }"
15
15
  v-on="readonly ? undefined : on"
16
- class="rounded-0"
16
+ class="rounded-inherit"
17
17
  >
18
- <template v-slot:prepend-inner>
18
+ <template v-if="model" v-slot:append>
19
19
  <div class="color-picker-inner-icon" :style="`background-color: ${model}`"></div>
20
20
  </template>
21
21
  </v-text-field>
@@ -39,6 +39,9 @@
39
39
  height: 20px;
40
40
  border-radius: 20px;
41
41
  }
42
+ .rounded-inherit{
43
+ border-radius: inherit;
44
+ }
42
45
  </style>
43
46
 
44
47
  <script>
@@ -17,7 +17,7 @@
17
17
  v-bind="{ ...$attrs, ...attrs }"
18
18
  v-on="readonly ? undefined : on"
19
19
  :clearable="!readonly"
20
- class="rounded-0"
20
+ class="rounded-inherit"
21
21
  ></v-text-field>
22
22
  </template>
23
23
  <v-date-picker v-model="model" :range="range" no-title>
@@ -28,6 +28,12 @@
28
28
  </div>
29
29
  </template>
30
30
 
31
+ <style scoped>
32
+ .rounded-inherit{
33
+ border-radius: inherit;
34
+ }
35
+ </style>
36
+
31
37
  <script>
32
38
  /**
33
39
  * This component is used to edit a date in iso format. It is a combination of "v-text-field" and "v-date-picker".
@@ -9,7 +9,7 @@
9
9
  readonly
10
10
  v-bind="{ ...$attrs, ...attrs }"
11
11
  v-on="readonly ? undefined : on"
12
- class="media-field--card rounded-0"
12
+ class="media-field--card"
13
13
  :class="{ 'media-field--selected': !!model }"
14
14
  :value="model ? ' ' : ''"
15
15
  >
@@ -56,7 +56,7 @@
56
56
  .media-field--selected {
57
57
  .v-text-field__slot {
58
58
  position: absolute !important;
59
- width: 100%;
59
+ width: calc(100% - 24px);
60
60
  height: 100%;
61
61
  }
62
62
  .v-input__append-inner {
@@ -101,6 +101,9 @@
101
101
  width: 100px;
102
102
  margin-bottom: 10px;
103
103
  }
104
+ .media-field--card{
105
+ border-radius: inherit;
106
+ }
104
107
  </style>
105
108
 
106
109
  <script>
@@ -2,21 +2,20 @@
2
2
  <div class="media-m2m--wrapper">
3
3
  <v-text-field
4
4
  readonly
5
+ hide-details
5
6
  v-bind="$attrs"
6
- @click="hasSelection || editSelection()"
7
- class="media-m2m--card rounded-0"
7
+ @click="!hasSelection && editSelection()"
8
+ class="media-m2m--card"
8
9
  :class="{ 'media-m2m--selected': !!hasSelection }"
9
10
  :value="hasSelection ? ' ' : ''"
10
11
  >
11
12
  <template v-slot:append>
12
- <v-btn v-if="hasSelection" @click="editSelection" tile small>{{
13
- $t("mapo.mediaM2MField.editSelection")
14
- }}</v-btn>
15
13
  <v-virtual-scroll
16
14
  v-if="hasSelection"
17
15
  :items="model"
18
16
  :height="model.length * 64 > 256 ? 256 : model.length * 64"
19
17
  item-height="64"
18
+ class="mb-4"
20
19
  >
21
20
  <template v-slot:default="{ item }">
22
21
  <v-divider></v-divider>
@@ -53,7 +52,10 @@
53
52
  </v-virtual-scroll>
54
53
  </template>
55
54
  </v-text-field>
56
-
55
+ <v-btn v-if="hasSelection" @click="editSelection" tile small block>{{
56
+ $t("mapo.mediaM2MField.editSelection")
57
+ }}</v-btn>
58
+ <v-messages v-if="!$attrs.hideDetails" class="mt-2" :value="$attrs.errorMessages" color="error"/>
57
59
  <media-manager-dialog
58
60
  v-model="dialog"
59
61
  select="multi"
@@ -90,6 +92,9 @@
90
92
  display: none;
91
93
  }
92
94
  }
95
+ .media-m2m--card {
96
+ border-radius: inherit;
97
+ }
93
98
  </style>
94
99
 
95
100
  <script>
@@ -1,57 +1,25 @@
1
- var useDarkMode = false;
2
-
3
- export default {
4
- plugins: 'mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount textpattern noneditable help charmap quickbars emoticons',
5
- // imagetools_cors_hosts: ['picsum.photos'],
6
- menubar: 'file edit view insert format tools table help',
7
- menu: { insert: { title: 'Insert', items: 'link mapomedia media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor | insertdatetime' } },
8
- toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview | mapomedia media template link anchor codesample | ltr rtl',
1
+ export default ({ isDark, base }) => ({
2
+ plugins: "mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount textpattern noneditable help charmap quickbars emoticons",
3
+ menubar: "file edit view insert format tools table help",
4
+ menu: {
5
+ insert: {
6
+ title: "Insert",
7
+ items: "link mapomedia media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor | insertdatetime",
8
+ },
9
+ },
10
+ toolbar: "undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview | mapomedia media template link anchor codesample | ltr rtl",
9
11
  toolbar_sticky: true,
10
12
  image_advtab: true,
11
- // link_list: [
12
- // { title: 'My page 1', value: 'https://www.tiny.cloud' },
13
- // { title: 'My page 2', value: 'http://www.moxiecode.com' }
14
- // ],
15
- // image_list: [
16
- // { title: 'My page 1', value: 'https://www.tiny.cloud' },
17
- // { title: 'My page 2', value: 'http://www.moxiecode.com' }
18
- // ],
19
- // image_class_list: [
20
- // { title: 'None', value: '' },
21
- // { title: 'Some class', value: 'class-name' }
22
- // ],
23
13
  importcss_append: true,
24
- // file_picker_callback: function (callback, value, meta) {
25
- // /* Provide file and text for the link dialog */
26
- // if (meta.filetype === 'file') {
27
- // callback('https://www.google.com/logos/google.jpg', { text: 'My text' });
28
- // }
29
-
30
- // /* Provide image and alt text for the image dialog */
31
- // if (meta.filetype === 'image') {
32
- // callback('https://www.google.com/logos/google.jpg', { alt: 'My alt text' });
33
- // }
34
-
35
- // /* Provide alternative source and posted for the media dialog */
36
- // if (meta.filetype === 'media') {
37
- // callback('movie.mp4', { source2: 'alt.ogg', poster: 'https://www.google.com/logos/google.jpg' });
38
- // }
39
- // },
40
- // templates: [
41
- // { title: 'New Table', description: 'creates a new table', content: '<div class="mceTmpl"><table width="98%%" border="0" cellspacing="0" cellpadding="0"><tr><th scope="col"> </th><th scope="col"> </th></tr><tr><td> </td><td> </td></tr></table></div>' },
42
- // { title: 'Starting my story', description: 'A cure for writers block', content: 'Once upon a time...' },
43
- // { title: 'New list with dates', description: 'New List with dates', content: '<div class="mceTmpl"><span class="cdate">cdate</span><br /><span class="mdate">mdate</span><h2>My List</h2><ul><li></li><li></li></ul></div>' }
44
- // ],
45
- template_cdate_format: '[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]',
46
- template_mdate_format: '[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]',
14
+ template_cdate_format: "[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]",
15
+ template_mdate_format: "[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]",
47
16
  height: 400,
48
17
  image_caption: true,
49
- quickbars_insert_toolbar: 'mapomedia quicktable',
50
- quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote mapomedia quicktable',
51
- noneditable_noneditable_class: 'mceNonEditable',
52
- toolbar_mode: 'sliding',
53
- contextmenu: 'link mapomedia table',
54
- skin: useDarkMode ? 'oxide-dark' : 'oxide',
55
- content_css: useDarkMode ? 'dark' : 'default',
56
- content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
57
- }
18
+ quickbars_insert_toolbar: "mapomedia quicktable",
19
+ quickbars_selection_toolbar: "bold italic | quicklink h2 h3 blockquote mapomedia quicktable",
20
+ noneditable_noneditable_class: "mceNonEditable",
21
+ toolbar_mode: "sliding",
22
+ contextmenu: "link mapomedia table",
23
+ skin_url: isDark ? `${base}mapo/tinymce-skins/mapo-dark` : `${base}mapo/tinymce-skins/mapo-light`,
24
+ content_style: "body { font-family:Helvetica,Arial,sans-serif; font-size:14px }",
25
+ });
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <div>
2
+ <div class="mapo-wyg-editor">
3
3
  <media-manager-dialog ref="mediaManager"></media-manager-dialog>
4
- <span v-if="label" class="v-label" :class="{'error--text': errorMessages && errorMessages.length}">{{ label }}:</span>
4
+ <span v-if="label" class="v-label" :class="{'error--text': hasErrors, 'text--secondary': !hasErrors}">{{ label }}:</span>
5
5
  <div ref="editorNode">
6
6
  <v-skeleton-loader
7
7
  type="table-heading, list-item-two-line, list-item-avatar-two-line, list-item-three-lineimage, table-tfoot"
@@ -13,6 +13,24 @@
13
13
  </div>
14
14
  </template>
15
15
 
16
+ <style lang="scss">
17
+ .tox-notifications-container,
18
+ .tox-statusbar__branding {
19
+ display: none;
20
+ }
21
+ .v-label.error--text{
22
+ animation: v-shake 0.6s cubic-bezier(0.25, 0.8, 0.5, 1);
23
+ }
24
+ .tox-tinymce-aux {
25
+ z-index: 200 !important;
26
+ }
27
+ .mapo-field--has-errors{
28
+ .tox.tox-tinymce{
29
+ border: solid var(--v-error-base) 2px;
30
+ }
31
+ }
32
+ </style>
33
+
16
34
  <script>
17
35
  import initMapoMedia from "./utils/mapomedia.plugin.js";
18
36
  import injectScript from "./utils/script.injector.js";
@@ -60,12 +78,18 @@ export default {
60
78
  },
61
79
 
62
80
  computed: {
81
+ hasErrors () { return this.errorMessages && this.errorMessages.length },
63
82
  editor: {
64
83
  cache: false,
65
84
  get() {
66
85
  return this.editorInstance;
67
86
  },
68
87
  },
88
+ defaultConfiguration(){
89
+ const { base } = this.$router.options;
90
+ const { isDark } = this.$vuetify.theme;
91
+ return defaults({ base, isDark })
92
+ }
69
93
  },
70
94
 
71
95
  mounted() {
@@ -76,18 +100,23 @@ export default {
76
100
  initEditor() {
77
101
  initMapoMedia(this.insertMediaCallback);
78
102
  window.tinymce.init(
79
- Object.assign(defaults, this.conf, {
103
+ Object.assign(this.defaultConfiguration, this.conf, {
80
104
  target: this.$refs.editorNode,
81
105
  readonly: this.readonly,
82
106
  setup: (ctx) => this.setupEditor(ctx),
83
107
  })
84
108
  );
109
+ window.document.addEventListener('click', this.closeModal);
85
110
  },
86
111
  setupEditor(editor) {
87
112
  this.editorInstance = editor;
88
113
  editor.on("init", () => {
89
- editor.setContent(this.value || "");
90
- this.emitContent(editor);
114
+ if (this.value){
115
+ editor.setContent(this.value);
116
+ this.emitContent(editor);
117
+ } else {
118
+ editor.setContent("");
119
+ }
91
120
  editor.on("change input undo redo keyup", () =>
92
121
  this.emitContent(editor)
93
122
  );
@@ -108,6 +137,10 @@ export default {
108
137
  });
109
138
  }
110
139
  },
140
+ closeModal(event){
141
+ if (event.target.classList.contains("tox-dialog-wrap__backdrop"))
142
+ this.editor.windowManager.close();
143
+ },
111
144
  insertMediaCallback: async function () {
112
145
  return new Promise((resolve, reject) => {
113
146
  this.$refs.mediaManager.open()
@@ -136,9 +169,17 @@ export default {
136
169
  .catch((error) => reject(error));
137
170
  });
138
171
  },
172
+ destroyEditor(){
173
+ window?.document?.removeEventListener('click', this.closeModal);
174
+ window?.tinymce?.remove(this.editor);
175
+ },
176
+ reloadEditor(){
177
+ this.destroyEditor();
178
+ this.initEditor();
179
+ }
139
180
  },
140
181
  beforeDestroy() {
141
- window && window.tinymce && window.tinymce.remove(this.editor);
182
+ this.destroyEditor();
142
183
  },
143
184
  watch: {
144
185
  value(val) {
@@ -152,23 +193,11 @@ export default {
152
193
  this.editor.setMode(val ? "readonly" : "design");
153
194
  }
154
195
  },
196
+ '$vuetify.theme.isDark'(){ this.reloadEditor(); }
155
197
  },
156
198
  };
157
199
  </script>
158
200
 
159
- <style>
160
- .tox-notifications-container,
161
- .tox-statusbar__branding {
162
- display: none;
163
- }
164
- .v-label.error--text{
165
- animation: v-shake 0.6s cubic-bezier(0.25, 0.8, 0.5, 1);
166
- }
167
- .tox-tinymce-aux {
168
- z-index: 200 !important;
169
- }
170
- </style>
171
-
172
201
  <docs>
173
202
 
174
203
  ### Defaults
@@ -59,7 +59,7 @@
59
59
  </template>
60
60
  <template v-if="navigable" v-slot:[`item.${firstColName}`]="{ item }">
61
61
  <NuxtLink :to="detailLink(item)">
62
- {{ getPointed(item, firstColName, "Unknown") }}
62
+ {{ getPointed(item, firstColName, "") || "Unknown" }}
63
63
  </NuxtLink>
64
64
  </template>
65
65
  <template v-slot:item.data-table-select="{ isSelected, select }" v-if="selectAll">
@@ -38,7 +38,8 @@
38
38
  import { mapGetters, mapActions } from "vuex";
39
39
 
40
40
  export default {
41
- computed: mapGetters("mapo/media", ["parentFolders"]),
42
- methods: mapActions("mapo/media", ["getRoot"]),
41
+ name: "MediaBreadcrumbs",
42
+ computed: {...mapGetters("mapo/media", ["parentFolders"])},
43
+ methods: {...mapActions("mapo/media", ["getRoot"])},
43
44
  };
44
45
  </script>
@@ -160,6 +160,7 @@
160
160
 
161
161
  <script>
162
162
  import { mapGetters, mapActions } from "vuex";
163
+ import { slugify } from "@mapomodule/utils/helpers/formatters";
163
164
 
164
165
  export default {
165
166
  name: "MediaFolders",
@@ -205,16 +206,7 @@ export default {
205
206
  this.dialog = false;
206
207
  this.folderEdit = {};
207
208
  },
208
- slugify(text) {
209
- return text
210
- .toString()
211
- .toLowerCase()
212
- .replace(/\s+/g, "-") // Replace spaces with -
213
- .replace(/[^\w\-]+/g, "") // Remove all non-word chars
214
- .replace(/\-\-+/g, "-") // Replace multiple - with single -
215
- .replace(/^-+/, "") // Trim - from start of text
216
- .replace(/-+$/, ""); // Trim - from end of text
217
- },
209
+ slugify,
218
210
  },
219
211
  computed: {
220
212
  ...mapGetters("mapo/media", [
@@ -235,37 +227,6 @@ export default {
235
227
  expandOnHover: !this.isMobile,
236
228
  };
237
229
  },
238
- rotate() {
239
- return {
240
- transform: this.expanded ? "rotate(180deg)" : "rotate(0deg)",
241
- transition: "transform .3s cubic-bezier(0.25, 0.8, 0.5, 1)",
242
- };
243
- },
244
- hideSlug() {
245
- return {
246
- maxWidth: this.expanded ? "105px" : "50px",
247
- maxHeight: this.expanded ? "24px" : "18px",
248
- opacity: this.expanded ? 0.8 : 0.8,
249
- transform: this.expanded ? "scale(1)" : "scale(0.7)",
250
- transition: "all .3s cubic-bezier(0.25, 0.8, 0.5, 1)",
251
- };
252
- },
253
- parentFolder() {
254
- return (
255
- (this.parentFolders &&
256
- this.parentFolders.length > 0 &&
257
- this.parentFolders[this.parentFolders.length - 1]) ||
258
- null
259
- );
260
- },
261
- updirFolder() {
262
- return (
263
- (this.parentFolders &&
264
- this.parentFolders.length > 1 &&
265
- this.parentFolders[this.parentFolders.length - 2]) ||
266
- null
267
- );
268
- },
269
230
  },
270
231
  };
271
232
  </script>
@@ -7,27 +7,50 @@
7
7
  fixed
8
8
  app
9
9
  >
10
- <div class="menu_container">
11
- <div>
12
- <SidebarProfile />
10
+ <div class="menu--container">
11
+ <div class="menu--container-top">
12
+ <component v-if="componentExists('MapoSidebarTitleTopSlot')" :is="'MapoSidebarTitleTopSlot'" />
13
+ <component v-if="componentExists('MapoSidebarTitleSlot')" :is="'MapoSidebarTitleSlot'" />
14
+ <SidebarTitle v-else />
15
+ <component v-if="componentExists('MapoSidebarTitleBottomSlot')" :is="'MapoSidebarTitleBottomSlot'" />
13
16
  <v-divider></v-divider>
14
17
  </div>
15
- <div class="menu_container">
16
- <SidebarList :force-collapse="miniVariant" />
17
- <SidebarFooter :force-collapse="miniVariant" />
18
+ <div class="menu--container-center">
19
+ <component v-if="componentExists('MapoSidebarListTopSlot')" :is="'MapoSidebarListTopSlot'" />
20
+ <component v-if="componentExists('MapoSidebarListSlot')" :is="'MapoSidebarListSlot'" />
21
+ <SidebarList v-else :force-collapse="miniVariant" />
22
+ <component v-if="componentExists('MapoSidebarListBottomSlot')" :is="'MapoSidebarListBottomSlot'" />
18
23
  </div>
24
+ <div class="menu--container-bottom">
25
+ <v-divider></v-divider>
26
+ <component v-if="componentExists('MapoSidebarListFooterTopSlot')" :is="'MapoSidebarListFooterTopSlot'" />
27
+ <component v-if="componentExists('MapoSidebarListFooterSlot')" :is="'MapoSidebarListFooterSlot'" />
28
+ <SidebarList v-else footer :force-collapse="miniVariant" />
29
+ <component v-if="componentExists('MapoSidebarListFooterBottomSlot')" :is="'MapoSidebarListFooterBottomSlot'" />
30
+ <v-divider></v-divider>
31
+ <component v-if="componentExists('MapoLogoutButtonTopSlot')" :is="'MapoLogoutButtonTopSlot'" />
32
+ <component v-if="componentExists('MapoLogoutButtonSlot')" :is="'MapoLogoutButtonSlot'" />
33
+ <LogoutButton v-else />
34
+ <component v-if="componentExists('MapoLogoutButtonBottomSlot')" :is="'MapoLogoutButtonBottomSlot'" />
35
+ </div>
19
36
  </div>
20
37
  </v-navigation-drawer>
21
38
  </template>
22
39
 
23
40
  <style lang="scss" scoped>
24
- @import "@mapomodule/uikit/assets/variables.scss";
25
- .menu_container {
41
+ .menu--container {
26
42
  display: flex;
27
43
  flex-direction: column;
28
44
  height: 100%;
29
- justify-content: space-between;
30
- flex: 1;
45
+ &-top{
46
+ justify-self: flex-start;
47
+ }
48
+ &-center{
49
+ flex: 1;
50
+ }
51
+ &-bottom{
52
+ justify-self: flex-end;
53
+ }
31
54
  }
32
55
  </style>
33
56
 
@@ -57,5 +80,10 @@ export default {
57
80
  },
58
81
  },
59
82
  },
83
+ methods:{
84
+ componentExists(name){
85
+ return name in this.$options.components;
86
+ }
87
+ }
60
88
  };
61
89
  </script>
@@ -21,19 +21,17 @@ import { buildRoutes } from "../routebuilder";
21
21
  export default {
22
22
  name: "SidebarList",
23
23
  props: {
24
- forceCollapse: {
25
- type: Boolean,
26
- default: false
27
- }
24
+ footer: Boolean,
25
+ forceCollapse: Boolean
28
26
  },
29
27
  data() {
30
28
  return {
31
- defaultIcon: ({label}) => `mdi-alpha-${label[0]}-box-outline`.toLowerCase(),
29
+ defaultIcon: ({label}) => `mdi-alpha-${label[0]}-box-${ this.footer ? '' : 'outline'}`.toLowerCase(),
32
30
  routes: this.routes,
33
31
  };
34
32
  },
35
33
  mounted() {
36
- this.routes = this.buildRoutes(this.$router.options.routes.filter(route => !route.meta || !route.meta.sidebarFooter));
34
+ this.routes = this.buildRoutes(this.$router.options.routes.filter(({ meta }) => !!meta?.sidebarFooter == this.footer));
37
35
  },
38
36
  methods: {
39
37
  buildRoutes(routes) {
@@ -44,6 +44,17 @@
44
44
  <style lang="scss" scoped>
45
45
  @import "@mapomodule/uikit/assets/variables.scss";
46
46
 
47
+ .v-list-item::after{
48
+ content: '';
49
+ position: absolute;
50
+ background: rgba(0, 0, 0, 0.2);
51
+ height: 100%;
52
+ width: 4px;
53
+ left: 0;
54
+ }
55
+ .v-list-item.v-list-item--active::after{
56
+ background: var(--v-primary-base);
57
+ }
47
58
  .expand-icon {
48
59
  margin: 0 0 0 auto;
49
60
  cursor: pointer;
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <v-list-item class="sidebar-title--container">
3
+ <v-list-item-avatar class="sidebar-title--logo" v-if="logo">
4
+ <v-img :src="logo"></v-img>
5
+ </v-list-item-avatar>
6
+ <v-list-item-icon v-else>
7
+ <v-icon color="secondary">mdi-artstation</v-icon>
8
+ </v-list-item-icon>
9
+ <v-list-item-title>
10
+ <b>{{title}}</b>
11
+ </v-list-item-title>
12
+ <v-btn icon @click.stop="toggleMiniVariant">
13
+ <v-icon>mdi-chevron-left</v-icon>
14
+ </v-btn>
15
+ </v-list-item>
16
+ </template>
17
+
18
+ <style lang="scss">
19
+ .sidebar-title--container{
20
+ background: var(--v-primary-base);
21
+ color: var(--v-secondary-base);
22
+ }
23
+ .sidebar-title--logo{
24
+ left: -8px;
25
+ }
26
+ </style>
27
+
28
+ <script>
29
+ // @vuese
30
+ export default {
31
+ computed:{
32
+ title(){
33
+ return this.$mapo.$options?.ui?.panelName || "BACKOFFICE"
34
+ },
35
+ logo(){
36
+ return this.$mapo.$options?.ui?.panelLogo
37
+ }
38
+ },
39
+ methods: {
40
+ toggleMiniVariant() {
41
+ this.$store.dispatch("mapo/app/toggleSidebarMinivariant");
42
+ },
43
+ },
44
+ };
45
+ </script>