@mapomodule/uikit 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (49) hide show
  1. package/CHANGELOG.md +370 -0
  2. package/components/Detail/Detail.vue +281 -126
  3. package/components/Detail/DetailField.vue +68 -29
  4. package/components/Detail/DetailLangSwitch.vue +1 -1
  5. package/components/Detail/defaults.js +33 -25
  6. package/components/DropArea.vue +3 -3
  7. package/components/List/List.vue +120 -42
  8. package/components/List/ListActions.vue +56 -17
  9. package/components/List/ListFilters.vue +158 -113
  10. package/components/List/ListHead.vue +30 -12
  11. package/components/List/ListQuickEdit.vue +207 -55
  12. package/components/List/ListTable.vue +292 -77
  13. package/components/Login.vue +14 -5
  14. package/components/MediaManager/MediaEditor.vue +253 -107
  15. package/components/MediaManager/MediaFolders.vue +134 -43
  16. package/components/MediaManager/MediaGallery.vue +56 -52
  17. package/components/MediaManager/MediaManager.vue +127 -83
  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/ThemeToggle.vue +13 -0
  23. package/components/fields/DateField.vue +9 -3
  24. package/components/fields/FileField.vue +125 -0
  25. package/components/fields/FksField.vue +88 -0
  26. package/components/fields/MediaField.vue +36 -6
  27. package/components/fields/MediaM2mField.vue +8 -3
  28. package/components/fields/Repeater.vue +338 -0
  29. package/components/fields/SeoPreview.vue +89 -0
  30. package/components/fields/{TinyMce → wygEditor}/defaults.js +7 -5
  31. package/components/fields/{TinyMce → wygEditor}/utils/events.js +0 -0
  32. package/components/fields/{TinyMce → wygEditor}/utils/mapomedia.plugin.js +7 -6
  33. package/components/fields/{TinyMce → wygEditor}/utils/script.injector.js +0 -0
  34. package/components/fields/wygEditor/wygEditor.vue +256 -0
  35. package/components/layout/Sidebar/Sidebar.vue +35 -32
  36. package/components/layout/Sidebar/SidebarFooter.vue +42 -46
  37. package/components/layout/Sidebar/SidebarList.vue +13 -14
  38. package/components/layout/Sidebar/SidebarListItem.vue +99 -38
  39. package/components/layout/Sidebar/SidebarProfile.vue +42 -0
  40. package/components/layout/Topbar/Topbar.vue +3 -35
  41. package/components/layout/routebuilder.js +3 -3
  42. package/defaults.js +2 -2
  43. package/layouts/default.vue +20 -18
  44. package/layouts/empty.vue +10 -0
  45. package/package.json +5 -4
  46. package/pages/index.vue +1 -2
  47. package/components/fields/M2mField.vue +0 -95
  48. package/components/fields/TinyMce/TinyMce.vue +0 -177
  49. package/layouts/error.vue +0 -45
@@ -0,0 +1,256 @@
1
+ <template>
2
+ <div>
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>
5
+ <div ref="editorNode">
6
+ <v-skeleton-loader
7
+ type="table-heading, list-item-two-line, list-item-avatar-two-line, list-item-three-lineimage, table-tfoot"
8
+ ></v-skeleton-loader>
9
+ </div>
10
+ <div class="mt-2">
11
+ <v-messages :value="errorMessages" color="error"></v-messages>
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import initMapoMedia from "./utils/mapomedia.plugin.js";
18
+ import injectScript from "./utils/script.injector.js";
19
+ import defaults from "./defaults.js";
20
+ import validEvents from "./utils/events.js";
21
+
22
+ /**
23
+ * This component wraps a [wygEditor](https://www.tiny.cloud/) instance. With the use of the v-model you can use this component to edit any content you like.
24
+ */
25
+
26
+ export default {
27
+ name: "wygEditor",
28
+ props: {
29
+ // V-model property. Is the content that will populate the wygEditor instance.
30
+ value: {
31
+ type: String,
32
+ default: "",
33
+ },
34
+ // This is the main configuration of wygEditor. If setted will be merged with this component defaults.
35
+ conf: {
36
+ type: Object,
37
+ default: () => ({}),
38
+ },
39
+ // This label will be shown at the top of the editor.
40
+ label: String,
41
+ // This is an array of validation errors that will be displayed under the editor.
42
+ errorMessages: Array,
43
+ // This set the component status to readonly, stopping the user interaction.
44
+ readonly: {
45
+ type: Boolean,
46
+ default: false,
47
+ },
48
+ // Use this prop to bind events. If set to true the component will emit every [wygEditor Event](https://www.tiny.cloud/docs/advanced/events/).
49
+ bindevents: {
50
+ type: Boolean,
51
+ default: false,
52
+ },
53
+ },
54
+
55
+ data() {
56
+ return {
57
+ editorInstance: null,
58
+ editorContent: "",
59
+ };
60
+ },
61
+
62
+ computed: {
63
+ editor: {
64
+ cache: false,
65
+ get() {
66
+ return this.editorInstance;
67
+ },
68
+ },
69
+ },
70
+
71
+ mounted() {
72
+ injectScript().then(this.initEditor);
73
+ },
74
+
75
+ methods: {
76
+ initEditor() {
77
+ initMapoMedia(this.insertMediaCallback);
78
+ window.tinymce.init(
79
+ Object.assign(defaults, this.conf, {
80
+ target: this.$refs.editorNode,
81
+ readonly: this.readonly,
82
+ setup: (ctx) => this.setupEditor(ctx),
83
+ })
84
+ );
85
+ },
86
+ setupEditor(editor) {
87
+ this.editorInstance = editor;
88
+ editor.on("init", () => {
89
+ editor.setContent(this.value || "");
90
+ this.emitContent(editor);
91
+ editor.on("change input undo redo keyup", () =>
92
+ this.emitContent(editor)
93
+ );
94
+ });
95
+ this.bindEvents(editor);
96
+ },
97
+ emitContent(editor) {
98
+ this.editorContent = editor.getContent();
99
+ // Fired when the v-model changes
100
+ //@arg Emits the content of the editor
101
+ this.$emit("input", this.editorContent);
102
+ },
103
+ bindEvents(editor) {
104
+ if (this.bindevents) {
105
+ validEvents.forEach((eventName) => {
106
+ // This is a dynamic event emitter. If you activate the bindevents prop, you will be able to listen to every [wygEditor Event](https://www.tiny.cloud/docs/advanced/events/).
107
+ editor.on(eventName, (event) => this.$emit(eventName, event));
108
+ });
109
+ }
110
+ },
111
+ insertMediaCallback: async function () {
112
+ return new Promise((resolve, reject) => {
113
+ this.$refs.mediaManager.open()
114
+ .then((result) => {
115
+ if (result) {
116
+ let html;
117
+ switch (result.mime_type && result.mime_type.split("/")[0]) {
118
+ case "image":
119
+ html = `<img width="300px" src="${result.file}" alt="${result.alt_text}">`;
120
+ break;
121
+ case "video":
122
+ html = `<video controls><source src="${result.file}" type="${result.mime_type}"></video>`;
123
+ break;
124
+ case "audio":
125
+ html = `<audio controls><source src="${result.file}" type="${result.mime_type}"></audio>`;
126
+ break;
127
+ default:
128
+ html = `<a href="${result.file}" target="_blank">${result.file}</a>`;
129
+ break;
130
+ }
131
+ resolve(html);
132
+ } else {
133
+ reject("No image selected");
134
+ }
135
+ })
136
+ .catch((error) => reject(error));
137
+ });
138
+ },
139
+ },
140
+ beforeDestroy() {
141
+ window && window.tinymce && window.tinymce.remove(this.editor);
142
+ },
143
+ watch: {
144
+ value(val) {
145
+ if (this.editor && this.editor.initialized && val !== this.editorContent) {
146
+ this.editorContent = val
147
+ this.editor.setContent(val);
148
+ }
149
+ },
150
+ readonly(val) {
151
+ if (this.editor && this.editor.initialized) {
152
+ this.editor.setMode(val ? "readonly" : "design");
153
+ }
154
+ },
155
+ },
156
+ };
157
+ </script>
158
+
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
+ <docs>
173
+
174
+ ### Defaults
175
+
176
+ This is the default [wygEditor configuration](https://www.tiny.cloud/docs/configure/).
177
+
178
+ ```js
179
+ {
180
+ 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',
181
+ menubar: 'file edit view insert format tools table help',
182
+ menu: { insert: { title: 'Insert', items: 'link mapomedia media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor | insertdatetime' } },
183
+ 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',
184
+ toolbar_sticky: true,
185
+ image_advtab: true,
186
+ importcss_append: true,
187
+ template_cdate_format: '[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]',
188
+ template_mdate_format: '[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]',
189
+ height: 400,
190
+ image_caption: true,
191
+ quickbars_insert_toolbar: 'mapomedia quicktable',
192
+ quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote mapomedia quicktable',
193
+ noneditable_noneditable_class: 'mceNonEditable',
194
+ toolbar_mode: 'sliding',
195
+ contextmenu: 'link mapomedia table',
196
+ skin: useDarkMode ? 'oxide-dark' : 'oxide',
197
+ content_css: useDarkMode ? 'dark' : 'default',
198
+ content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
199
+ }
200
+ ```
201
+ <br><br>
202
+
203
+ ## Live Demo
204
+
205
+ <br>
206
+
207
+ ::: warning LIVE DEMO 🎉🎉🎉
208
+ This is an interactive example. You can play with it but remember that all http features are disabled since there is no backend server.
209
+ :::
210
+
211
+ ::: demo
212
+ <template>
213
+ <v-app>
214
+ <wygEditor v-model="tinyInput" :readonly="readonly" />
215
+ <v-btn dark class="mb-2" @click.native="readonly = !readonly">
216
+ {{ readonly ? "Enable" : "Disable" }} editor
217
+ </v-btn>
218
+ </v-app>
219
+ </template>
220
+
221
+ <script>
222
+ export default {
223
+ data() {
224
+ return {
225
+ readonly: false,
226
+ tinyInput: `
227
+ <p style="text-align: center;"><span style="color: #bdc3c7;">&rarr; This is a full-featured editor demo. Please explore!
228
+ &larr;</span></p>
229
+ <p style="text-align: center;">&nbsp;</p>
230
+ <h2 style="text-align: center;">TinyMCE is the world's most customizable, and flexible, rich text editor.</h2>
231
+ <p style="text-align: center;"><strong> <span style="font-size: 14pt;"> <span style="color: #7e8c8d; font-weight: 600;">
232
+ A featherweight download, TinyMCE can handle any challenge you throw at it. </span> </span> </strong>
233
+ </p>
234
+ <p style="text-align: center;">&nbsp;</p>
235
+ <table style="border-collapse: collapse; width: 85%; margin-left: auto; margin-right: auto; border: 0;">
236
+ <tbody>
237
+ <tr>
238
+ <td style="width: 25%; text-align: center; padding: 7px;"><span style="color: #95a5a6;">🛠 50+
239
+ Plugins</span></td>
240
+ <td style="width: 25%; text-align: center; padding: 7px;"><span style="color: #95a5a6;">💡 Premium
241
+ Support</span></td>
242
+ <td style="width: 25%; text-align: center; padding: 7px;"><span style="color: #95a5a6;">🖍 Custom
243
+ Skins</span></td>
244
+ <td style="width: 25%; text-align: center; padding: 7px;"><span style="color: #95a5a6;">⚙ Full API
245
+ Access</span></td>
246
+ </tr>
247
+ </tbody>
248
+ </table>
249
+ `,
250
+ };
251
+ },
252
+ };
253
+ </script>
254
+ :::
255
+
256
+ </docs>
@@ -1,58 +1,61 @@
1
1
  <template>
2
2
  <v-navigation-drawer
3
- v-model="drawerSetter"
4
- :mini-variant="miniVariant"
3
+ v-model="drawer"
4
+ :mini-variant.sync="miniVariant"
5
+ width="300"
5
6
  :clipped="this.$store.getters['mapo/app/clipped']"
6
7
  fixed
7
8
  app
8
9
  >
9
- <div class="sidebar__core">
10
- <SidebarList />
11
- <SidebarFooter />
10
+ <div class="menu_container">
11
+ <div>
12
+ <SidebarProfile />
13
+ <v-divider></v-divider>
14
+ </div>
15
+ <div class="menu_container">
16
+ <SidebarList :force-collapse="miniVariant" />
17
+ <SidebarFooter :force-collapse="miniVariant" />
18
+ </div>
12
19
  </div>
13
20
  </v-navigation-drawer>
14
21
  </template>
15
22
 
16
23
  <style lang="scss" scoped>
17
- @import '@mapomodule/uikit/assets/variables.scss';
18
-
19
- .sidebar {
20
- &__core {
21
- display: flex;
22
- flex-direction: column;
23
- height: 100%;
24
- // background: $b-1;
25
- // color: $white;
26
- }
24
+ @import "@mapomodule/uikit/assets/variables.scss";
25
+ .menu_container {
26
+ display: flex;
27
+ flex-direction: column;
28
+ height: 100%;
29
+ justify-content: space-between;
30
+ flex: 1;
27
31
  }
28
32
  </style>
29
33
 
30
34
  <script>
31
- import { mapMutations } from 'vuex'
32
35
  // @vuese
33
36
  export default {
34
37
  name: "Sidebar",
35
- data () {
36
- return {
37
- miniVariant: false,
38
- }
39
- },
40
38
  computed: {
41
- drawerSetter: {
39
+ drawer: {
42
40
  get() {
43
- return this.$store.getters['mapo/app/drawer'];
41
+ return this.$store.getters["mapo/app/drawer"];
44
42
  },
45
43
  set(value) {
46
- if (this.$store.getters['mapo/app/drawer'] !== value)
44
+ if (this.$store.getters["mapo/app/drawer"] !== value)
47
45
  this.$store.dispatch("mapo/app/toggleSidebarDrawer");
48
46
  return value;
49
- }
50
- }
51
- },
52
- methods: {
53
- drawerReverse () {
54
- return this.drawer = !this.drawer
47
+ },
55
48
  },
56
- }
57
- }
49
+ miniVariant: {
50
+ get() {
51
+ return this.$store.getters["mapo/app/minivariant"];
52
+ },
53
+ set(value) {
54
+ if (this.$store.getters["mapo/app/minivariant"] !== value)
55
+ this.$store.dispatch("mapo/app/toggleSidebarMinivariant");
56
+ return value;
57
+ },
58
+ },
59
+ },
60
+ };
58
61
  </script>
@@ -1,68 +1,61 @@
1
1
  <template>
2
- <div class="sidebar__ender">
3
- <sidebar-list-item
4
- class="sidebar__ender__item"
5
- v-for="(item, i) in routes"
6
- :key="i"
7
- :link="item.link"
8
- :label="item.label"
9
- :childrens="item.childrens"
10
- :icon="item.icon"
11
- />
12
- <logout-button class="sidebar__ender__item sidebar__ender__item--logout" />
2
+ <div>
3
+ <v-divider></v-divider>
4
+ <v-list dense class="py-0">
5
+ <SidebarListItem
6
+ v-for="(item, i) in routes"
7
+ :key="i"
8
+ :link="item.link"
9
+ :label="item.label"
10
+ :meta="item.meta"
11
+ :childrens="item.childrens"
12
+ :icon="item.icon"
13
+ :force-collapse="forceCollapse"
14
+ />
15
+ </v-list>
16
+ <v-divider></v-divider>
17
+ <v-list-item v-if="$mapo.$auth.user.isLoggedIn" dense class="logout__button" link @click.native="logout">
18
+ <v-list-item-icon>
19
+ <v-icon>mdi-logout</v-icon>
20
+ </v-list-item-icon>
21
+ <v-list-item-title> Logout </v-list-item-title>
22
+ </v-list-item>
13
23
  </div>
14
24
  </template>
15
25
 
16
26
  <style lang="scss" scoped>
17
- @import "@mapomodule/uikit/assets/variables.scss";
18
-
19
- .sidebar {
20
- &__ender {
21
- margin-top: auto;
22
- display: flex;
23
- flex-direction: column;
24
- &__icon {
25
- font-size: 1rem;
26
- margin-right: 0.5rem;
27
- }
28
- &__item {
29
- display: block;
30
- width: 100%;
31
- text-decoration: none;
32
- color: white;
33
- background: $b-2;
34
- transition: all linear 0.25s;
35
- border-radius: 0;
36
- &:hover {
37
- background: rgba($b-2, 0.25);
38
- }
39
- &--logout {
40
- background: $black !important;
41
- &:hover {
42
- background: rgba($black, 0.25) !important;
43
- }
44
- }
45
- }
27
+ .logout__button{
28
+ &.theme--light{
29
+ background: #ffffffd6;
30
+ filter: invert(1);
31
+ }
32
+ &.theme--dark{
33
+ background: #121212;
46
34
  }
47
35
  }
48
36
  </style>
49
-
50
37
  <script>
51
38
  import { buildRoutes } from "../routebuilder";
52
39
 
53
40
  // @vuese
54
41
  export default {
55
42
  name: "SidebarFooter",
43
+ props: {
44
+ forceCollapse: {
45
+ type: Boolean,
46
+ default: false
47
+ }
48
+ },
56
49
  data() {
57
50
  return {
58
- defaultIcon: ({label}) => `mdi-alpha-${label[0]}-box`.toLowerCase(),
59
- routes: this.routes,
51
+ defaultIcon: ({ label }) => `mdi-alpha-${label[0]}-box`.toLowerCase(),
52
+ routes: this.routes
60
53
  };
61
54
  },
62
- mounted: function () {
55
+ mounted() {
63
56
  this.routes = this.buildRoutes(
64
57
  this.$router.options.routes.filter(
65
- (route) => route.meta && route.meta.sidebarFooter === true
58
+ route => route.meta && route.meta.sidebarFooter === true
66
59
  )
67
60
  );
68
61
  },
@@ -70,6 +63,9 @@ export default {
70
63
  buildRoutes(routes) {
71
64
  return buildRoutes(routes, this.defaultIcon);
72
65
  },
73
- },
66
+ logout() {
67
+ this.$store.dispatch("mapo/user/logout");
68
+ }
69
+ }
74
70
  };
75
71
  </script>
@@ -1,39 +1,38 @@
1
1
  <template>
2
- <div class="sidebar__list">
2
+ <v-list dense class="py-0 overflow-y-auto">
3
3
  <SidebarListItem
4
- class="sidebar__list__item"
5
4
  v-for="(item, i) in routes"
6
5
  :key="i"
7
6
  :link="item.link"
8
7
  :label="item.label"
8
+ :meta="item.meta"
9
9
  :childrens="item.childrens"
10
10
  :icon="item.icon"
11
+ :force-collapse="forceCollapse"
12
+ spider-menu
11
13
  />
12
- </div>
14
+ </v-list>
13
15
  </template>
14
16
 
15
- <style lang="scss" scoped>
16
- .sidebar {
17
- &__list {
18
- display: flex;
19
- flex-direction: column;
20
- }
21
- }
22
- </style>
23
-
24
17
  <script>
25
18
  import { buildRoutes } from "../routebuilder";
26
19
 
27
20
  // @vuese
28
21
  export default {
29
22
  name: "SidebarList",
23
+ props: {
24
+ forceCollapse: {
25
+ type: Boolean,
26
+ default: false
27
+ }
28
+ },
30
29
  data() {
31
30
  return {
32
- defaultIcon: ({label}) => `mdi-alpha-${label[0]}-circle`.toLowerCase(),
31
+ defaultIcon: ({label}) => `mdi-alpha-${label[0]}-box-outline`.toLowerCase(),
33
32
  routes: this.routes,
34
33
  };
35
34
  },
36
- mounted: function () {
35
+ mounted() {
37
36
  this.routes = this.buildRoutes(this.$router.options.routes.filter(route => !route.meta || !route.meta.sidebarFooter));
38
37
  },
39
38
  methods: {