@mapomodule/uikit 1.0.0-alpha.0 → 1.0.0-alpha.12

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 (44) hide show
  1. package/CHANGELOG.md +228 -0
  2. package/LICENSE.md +20 -0
  3. package/components/Detail/Detail.vue +209 -120
  4. package/components/Detail/DetailField.vue +57 -30
  5. package/components/Detail/DetailLangSwitch.vue +1 -1
  6. package/components/Detail/defaults.js +32 -25
  7. package/components/DropArea.vue +3 -3
  8. package/components/List/List.vue +100 -40
  9. package/components/List/ListActions.vue +56 -17
  10. package/components/List/ListFilters.vue +127 -113
  11. package/components/List/ListHead.vue +30 -12
  12. package/components/List/ListQuickEdit.vue +198 -55
  13. package/components/List/ListTable.vue +227 -78
  14. package/components/Login.vue +14 -5
  15. package/components/MediaManager/MediaEditor.vue +253 -107
  16. package/components/MediaManager/MediaFolders.vue +125 -41
  17. package/components/MediaManager/MediaGallery.vue +56 -52
  18. package/components/MediaManager/MediaManager.vue +114 -74
  19. package/components/MediaManager/MediaManagerDialog.vue +19 -22
  20. package/components/MediaManager/MediaPreview.vue +180 -0
  21. package/components/MediaManager/MediaUploader.vue +35 -32
  22. package/components/SnackBar.vue +3 -4
  23. package/components/fields/DateField.vue +9 -3
  24. package/components/fields/FileField.vue +108 -0
  25. package/components/fields/FksField.vue +60 -0
  26. package/components/fields/MediaField.vue +24 -6
  27. package/components/fields/MediaM2mField.vue +8 -3
  28. package/components/fields/SeoPreview.vue +89 -0
  29. package/components/fields/{TinyMce → wygEditor}/defaults.js +6 -4
  30. package/components/fields/{TinyMce → wygEditor}/utils/events.js +0 -0
  31. package/components/fields/{TinyMce → wygEditor}/utils/mapomedia.plugin.js +7 -6
  32. package/components/fields/{TinyMce → wygEditor}/utils/script.injector.js +0 -0
  33. package/components/fields/{TinyMce/TinyMce.vue → wygEditor/wygEditor.vue} +43 -21
  34. package/components/layout/Sidebar/Sidebar.vue +46 -24
  35. package/components/layout/Sidebar/SidebarFooter.vue +42 -46
  36. package/components/layout/Sidebar/SidebarList.vue +13 -14
  37. package/components/layout/Sidebar/SidebarListItem.vue +81 -38
  38. package/components/layout/Topbar/Topbar.vue +3 -36
  39. package/components/layout/routebuilder.js +1 -1
  40. package/defaults.js +2 -2
  41. package/layouts/default.vue +3 -14
  42. package/package.json +3 -3
  43. package/pages/index.vue +15 -78
  44. package/components/fields/M2mField.vue +0 -95
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <div class="container">
3
+ <div class="preview">
4
+ <span class="preview__title">{{ getTitle }}</span>
5
+ <br />
6
+ <span class="preview__url">{{ getPermalink }}</span>
7
+ <br />
8
+ <span class="preview__desc">{{ getDescription }}</span>
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <style lang="scss" scoped>
14
+ .container {
15
+ background: #ffffff;
16
+ border-radius: 3px;
17
+ }
18
+ .preview {
19
+ display: block;
20
+ max-width: 32em;
21
+ margin: 30px 8px;
22
+ &__title {
23
+ color: #035ac6;
24
+ font-size: 1.2em;
25
+ cursor: pointer;
26
+ &:hover {
27
+ text-decoration: underline;
28
+ }
29
+ }
30
+ &__url {
31
+ color: green;
32
+ font-size: 0.92em;
33
+ }
34
+ &__desc {
35
+ color: #9b9da1;
36
+ }
37
+ }
38
+ </style>
39
+
40
+ <script>
41
+ /**
42
+ * This component is used to make a preview of seo data.
43
+ */
44
+ export default {
45
+ name: "SeoPreview",
46
+ props: {
47
+ // V-model for DetailField (need to be an object `{title, permalink, description}`)
48
+ value:{
49
+ type: Object,
50
+ default: () => {}
51
+ },
52
+ // Seo title
53
+ title: {
54
+ type: String,
55
+ default:
56
+ "It was the best of times, it was the blurst of times, it was the ..."
57
+ },
58
+ // Seo permalink
59
+ permalink: {
60
+ type: String,
61
+ default: "example.com/how_to_dive"
62
+ },
63
+ // Seo description
64
+ description: {
65
+ type: String,
66
+ default:
67
+ "This is an example description that will get replaced when you start typing. Make sure to keep descriptions mobile-friendly and keyword-rich!"
68
+ }
69
+ },
70
+ computed: {
71
+ getTitle(){
72
+ if (this.value && this.value.title)
73
+ return this.value.title
74
+ return this.title
75
+ },
76
+ getPermalink(){
77
+ if (this.value && this.value.permalink)
78
+ return this.value.permalink
79
+ return this.permalink
80
+ },
81
+ getDescription(){
82
+ if (this.value && this.value.description)
83
+ return this.value.description
84
+ return this.description
85
+ }
86
+ },
87
+
88
+ };
89
+ </script>
@@ -4,7 +4,8 @@ export default {
4
4
  plugins: 'mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable help charmap quickbars emoticons',
5
5
  // imagetools_cors_hosts: ['picsum.photos'],
6
6
  menubar: 'file edit view insert format tools table help',
7
- 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 | insertfile image mapomedia media template link anchor codesample | ltr rtl',
7
+ menu: { insert: { title: 'Insert', items: 'link mapomedia media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | 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',
8
9
  toolbar_sticky: true,
9
10
  image_advtab: true,
10
11
  // link_list: [
@@ -43,12 +44,13 @@ export default {
43
44
  // ],
44
45
  template_cdate_format: '[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]',
45
46
  template_mdate_format: '[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]',
46
- height: 600,
47
+ height: 400,
47
48
  image_caption: true,
48
- quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote quickimage quicktable',
49
+ quickbars_insert_toolbar: 'mapomedia quicktable',
50
+ quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote mapomedia quicktable',
49
51
  noneditable_noneditable_class: 'mceNonEditable',
50
52
  toolbar_mode: 'sliding',
51
- contextmenu: 'link image imagetools table',
53
+ contextmenu: 'link mapomedia imagetools table',
52
54
  skin: useDarkMode ? 'oxide-dark' : 'oxide',
53
55
  content_css: useDarkMode ? 'dark' : 'default',
54
56
  content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
@@ -1,24 +1,25 @@
1
1
  export default function (callback) {
2
2
  const pluginmanager = window.tinymce.util.Tools.resolve('tinymce.PluginManager');
3
- pluginmanager.add('mapomedia', function (editor, url) {
4
- const conf = ['mapomedia', {
3
+ const pluginname = "mapomedia"
4
+ pluginmanager.add(pluginname, function (editor, url) {
5
+ const conf = {
5
6
  icon: 'image',
6
- text: 'Mapo Media',
7
+ tooltip: 'Insert image/video/audio/docs',
7
8
  onAction: () => callback().then(html => {
8
9
  editor.focus();
9
10
  editor.undoManager.transact(() => editor.selection.setContent(html))
10
11
  editor.selection.setCursorLocation();
11
12
  editor.nodeChanged();
12
13
  }).catch(() => null)
13
- }]
14
+ }
14
15
  editor.addCommand('mceMapoMedia', () => callback().then(html => {
15
16
  editor.focus();
16
17
  editor.undoManager.transact(() => editor.selection.setContent(html))
17
18
  editor.selection.setCursorLocation();
18
19
  editor.nodeChanged();
19
20
  }).catch(() => null))
20
- editor.ui.registry.addButton(...conf);
21
- editor.ui.registry.addMenuItem(...conf);
21
+ editor.ui.registry.addButton(pluginname, conf);
22
+ editor.ui.registry.addMenuItem(pluginname, { text: "Mapo Media...", ...conf });
22
23
  return {
23
24
  getMetadata: function () {
24
25
  return {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <media-manager-dialog ref="mediaManager"></media-manager-dialog>
4
- <span v-if="label">{{ label }}:</span>
4
+ <span v-if="label" class="v-label" :class="{'error--text': errorMessages && errorMessages.length}">{{ 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"
@@ -20,18 +20,18 @@ import defaults from "./defaults.js";
20
20
  import validEvents from "./utils/events.js";
21
21
 
22
22
  /**
23
- * This component wraps a [TinyMce](https://www.tiny.cloud/) instance. With the use of the v-model you can use this component to edit any content you like.
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
24
  */
25
25
 
26
26
  export default {
27
- name: "TinyMce",
27
+ name: "wygEditor",
28
28
  props: {
29
- // V-model property. Is the content that will populate the TinyMce instance.
29
+ // V-model property. Is the content that will populate the wygEditor instance.
30
30
  value: {
31
31
  type: String,
32
32
  default: "",
33
33
  },
34
- // This is the main configuration of TinyMce. If setted will be merged with this component defaults.
34
+ // This is the main configuration of wygEditor. If setted will be merged with this component defaults.
35
35
  conf: {
36
36
  type: Object,
37
37
  default: () => ({}),
@@ -40,12 +40,12 @@ export default {
40
40
  label: String,
41
41
  // This is an array of validation errors that will be displayed under the editor.
42
42
  errorMessages: Array,
43
- // This set the component status to disabled, stopping the user interaction.
44
- disabled: {
43
+ // This set the component status to readonly, stopping the user interaction.
44
+ readonly: {
45
45
  type: Boolean,
46
46
  default: false,
47
47
  },
48
- // Use this prop to bind events. If set to true the component will emit every [TinyMce Event](https://www.tiny.cloud/docs/advanced/events/).
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
49
  bindevents: {
50
50
  type: Boolean,
51
51
  default: false,
@@ -74,11 +74,11 @@ export default {
74
74
 
75
75
  methods: {
76
76
  initEditor() {
77
- initMapoMedia(this.insertImgCallback);
77
+ initMapoMedia(this.insertMediaCallback);
78
78
  window.tinymce.init(
79
79
  Object.assign(defaults, this.conf, {
80
80
  target: this.$refs.editorNode,
81
- readonly: this.disabled,
81
+ readonly: this.readonly,
82
82
  setup: (ctx) => this.setupEditor(ctx),
83
83
  })
84
84
  );
@@ -103,20 +103,36 @@ export default {
103
103
  bindEvents(editor) {
104
104
  if (this.bindevents) {
105
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 [TinyMce Event](https://www.tiny.cloud/docs/advanced/events/).
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
107
  editor.on(eventName, (event) => this.$emit(eventName, event));
108
108
  });
109
109
  }
110
110
  },
111
- insertImgCallback: async function () {
111
+ insertMediaCallback: async function () {
112
112
  return new Promise((resolve, reject) => {
113
- this.$refs.mediaManager
114
- .open()
115
- .then((result) =>
116
- result
117
- ? resolve(`<img width="50%" src="${result.file}">`)
118
- : reject("No image selected")
119
- )
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
+ })
120
136
  .catch((error) => reject(error));
121
137
  });
122
138
  },
@@ -131,7 +147,7 @@ export default {
131
147
  this.editor.setContent(val);
132
148
  }
133
149
  },
134
- disabled(val) {
150
+ readonly(val) {
135
151
  if (this.editor && this.editor.initialized) {
136
152
  this.editor.setMode(val ? "readonly" : "design");
137
153
  }
@@ -145,13 +161,19 @@ export default {
145
161
  .tox-statusbar__branding {
146
162
  display: none;
147
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
+ }
148
170
  </style>
149
171
 
150
172
  <docs>
151
173
 
152
174
  ### Defaults
153
175
 
154
- This is the default [TinyMce configuration](https://www.tiny.cloud/docs/configure/).
176
+ This is the default [wygEditor configuration](https://www.tiny.cloud/docs/configure/).
155
177
 
156
178
  ```js
157
179
  {
@@ -1,58 +1,80 @@
1
1
  <template>
2
2
  <v-navigation-drawer
3
3
  v-model="drawerSetter"
4
- :mini-variant="miniVariant"
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
+ <v-list-item>
13
+ <v-list-item-avatar v-if="avatar">
14
+ <v-img :src="avatar"></v-img>
15
+ </v-list-item-avatar>
16
+ <v-list-item-icon v-else>
17
+ <v-icon>mdi-account</v-icon>
18
+ </v-list-item-icon>
19
+ <v-list-item-title>{{
20
+ this.$mapo.$auth.user.username
21
+ }}</v-list-item-title>
22
+ <v-btn icon @click.stop="miniVariant = !miniVariant">
23
+ <v-icon>mdi-chevron-left</v-icon>
24
+ </v-btn>
25
+ </v-list-item>
26
+ <v-divider></v-divider>
27
+ </div>
28
+ <div class="menu_container">
29
+ <SidebarList :force-collapse="miniVariant" />
30
+ <SidebarFooter :force-collapse="miniVariant" />
31
+ </div>
12
32
  </div>
13
33
  </v-navigation-drawer>
14
34
  </template>
15
35
 
16
36
  <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
- }
37
+ @import "@mapomodule/uikit/assets/variables.scss";
38
+ .menu_container {
39
+ display: flex;
40
+ flex-direction: column;
41
+ height: 100%;
42
+ justify-content: space-between;
43
+ flex: 1;
27
44
  }
28
45
  </style>
29
46
 
30
47
  <script>
31
- import { mapMutations } from 'vuex'
32
48
  // @vuese
33
49
  export default {
34
50
  name: "Sidebar",
35
- data () {
51
+ data() {
36
52
  return {
37
- miniVariant: false,
38
- }
53
+ miniVariant: false
54
+ };
39
55
  },
40
56
  computed: {
41
57
  drawerSetter: {
42
58
  get() {
43
- return this.$store.getters['mapo/app/drawer'];
59
+ return this.$store.getters["mapo/app/drawer"];
44
60
  },
45
61
  set(value) {
46
- if (this.$store.getters['mapo/app/drawer'] !== value)
62
+ if (this.$store.getters["mapo/app/drawer"] !== value)
47
63
  this.$store.dispatch("mapo/app/toggleSidebarDrawer");
48
64
  return value;
49
65
  }
66
+ },
67
+ username() {
68
+ return this.$mapo.$auth.user.username;
69
+ },
70
+ avatar() {
71
+ return this.$mapo.$auth.user.avatar;
50
72
  }
51
73
  },
52
74
  methods: {
53
- drawerReverse () {
54
- return this.drawer = !this.drawer
55
- },
75
+ drawerReverse() {
76
+ return (this.drawer = !this.drawer);
77
+ }
56
78
  }
57
- }
79
+ };
58
80
  </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 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: {