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

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 (55) hide show
  1. package/CHANGELOG.md +406 -0
  2. package/components/Detail/Detail.vue +288 -260
  3. package/components/Detail/DetailLangSwitch.vue +1 -1
  4. package/components/DropArea.vue +3 -3
  5. package/components/Form/Form.vue +224 -0
  6. package/components/Form/FormField.vue +185 -0
  7. package/components/Form/FormGroup.vue +88 -0
  8. package/components/Form/FormTabs.vue +134 -0
  9. package/components/Form/defaults.js +58 -0
  10. package/components/{fields → Form/fields}/DateField.vue +9 -3
  11. package/components/Form/fields/FileField.vue +125 -0
  12. package/components/Form/fields/FksField.vue +88 -0
  13. package/components/{fields → Form/fields}/MediaField.vue +36 -6
  14. package/components/{fields → Form/fields}/MediaM2mField.vue +8 -3
  15. package/components/Form/fields/Repeater.vue +562 -0
  16. package/components/Form/fields/SeoPreview.vue +89 -0
  17. package/components/{fields/TinyMce → Form/fields/wygEditor}/defaults.js +7 -5
  18. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/events.js +0 -0
  19. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/mapomedia.plugin.js +7 -6
  20. package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/script.injector.js +0 -0
  21. package/components/Form/fields/wygEditor/wygEditor.vue +256 -0
  22. package/components/List/List.vue +120 -42
  23. package/components/List/ListActions.vue +56 -17
  24. package/components/List/ListFilters.vue +158 -113
  25. package/components/List/ListHead.vue +30 -12
  26. package/components/List/ListQuickEdit.vue +128 -59
  27. package/components/List/ListTable.vue +293 -80
  28. package/components/Login.vue +14 -5
  29. package/components/MediaManager/MediaEditor.vue +253 -107
  30. package/components/MediaManager/MediaFolders.vue +134 -43
  31. package/components/MediaManager/MediaGallery.vue +56 -52
  32. package/components/MediaManager/MediaManager.vue +127 -83
  33. package/components/MediaManager/MediaManagerDialog.vue +19 -22
  34. package/components/MediaManager/MediaPreview.vue +180 -0
  35. package/components/MediaManager/MediaUploader.vue +35 -32
  36. package/components/SnackBar.vue +3 -4
  37. package/components/ThemeToggle.vue +13 -0
  38. package/components/layout/Sidebar/Sidebar.vue +35 -32
  39. package/components/layout/Sidebar/SidebarFooter.vue +42 -46
  40. package/components/layout/Sidebar/SidebarList.vue +13 -14
  41. package/components/layout/Sidebar/SidebarListItem.vue +99 -38
  42. package/components/layout/Sidebar/SidebarProfile.vue +42 -0
  43. package/components/layout/Topbar/Topbar.vue +3 -35
  44. package/components/layout/routebuilder.js +3 -3
  45. package/defaults.js +2 -2
  46. package/layouts/default.vue +20 -18
  47. package/layouts/empty.vue +10 -0
  48. package/module.js +1 -1
  49. package/package.json +5 -4
  50. package/pages/index.vue +1 -2
  51. package/components/Detail/DetailField.vue +0 -129
  52. package/components/Detail/defaults.js +0 -50
  53. package/components/fields/M2mField.vue +0 -95
  54. package/components/fields/TinyMce/TinyMce.vue +0 -177
  55. package/layouts/error.vue +0 -45
@@ -1,95 +0,0 @@
1
- <template>
2
- <div>
3
- <v-checkbox
4
- v-for="(option, index) in options"
5
- :key="index"
6
- :label="option[itemText]"
7
- :input-value="isSelected(option)"
8
- @change="changed($event, option)"
9
- >
10
- </v-checkbox>
11
- </div>
12
- </template>
13
-
14
- <script>
15
- /**
16
- * This component is made to simplify Many To Many associations. With this component you can modify an array selecting items from a list of checkboxes.
17
- */
18
-
19
- export default {
20
- name: "M2mField",
21
- data() {
22
- return {
23
- proxyItems: []
24
- };
25
- },
26
- props: {
27
- // V-model property. It is the array to be modified.
28
- value: {
29
- type: Array,
30
- required: true
31
- },
32
- // This is the array of options from which you can choose.
33
- items: {
34
- type: Array,
35
- default: () => []
36
- },
37
- itemText: {
38
- type: String,
39
- default: "text"
40
- },
41
- itemValue: {
42
- type: String,
43
- default: "*"
44
- },
45
- lookup: {
46
- type: String,
47
- default: "id"
48
- },
49
- endPoint: String,
50
- mapping: {
51
- type: Function,
52
- default: items => items
53
- }
54
- },
55
- computed: {
56
- hasKey() {
57
- return this.itemValue !== "*";
58
- },
59
- options() {
60
- return this.mapping(this.proxyItems);
61
- }
62
- },
63
- methods: {
64
- isSelected(option) {
65
- return !!(this.value || []).find(
66
- e => e[this.lookup] == option[this.lookup]
67
- );
68
- },
69
- changed(value, option) {
70
- let val = this.hasKey ? option[this.itemValue] : option;
71
- let newArr = [...(this.value || [])];
72
- if (value) {
73
- newArr.push(val);
74
- } else {
75
- let i = newArr.findIndex(e => e[this.lookup] == option[this.lookup]);
76
- i !== -1 && newArr.splice(i, 1);
77
- }
78
- this.$emit("input", newArr);
79
- }
80
- },
81
- watch: {
82
- items(val) {
83
- this.proxyItems = val;
84
- }
85
- },
86
- mounted() {
87
- if (this.endPoint && (!this.items || !this.items.length)) {
88
- this.$mapo.$api
89
- .crud(this.endPoint)
90
- .list()
91
- .then(res => (this.proxyItems = res));
92
- }
93
- }
94
- };
95
- </script>
@@ -1,177 +0,0 @@
1
- <template>
2
- <div>
3
- <media-manager-dialog ref="mediaManager"></media-manager-dialog>
4
- <span v-if="label">{{ 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 [TinyMce](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: "TinyMce",
28
- props: {
29
- // V-model property. Is the content that will populate the TinyMce instance.
30
- value: {
31
- type: String,
32
- default: "",
33
- },
34
- // This is the main configuration of TinyMce. 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 disabled, stopping the user interaction.
44
- disabled: {
45
- type: Boolean,
46
- default: false,
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/).
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.insertImgCallback);
78
- window.tinymce.init(
79
- Object.assign(defaults, this.conf, {
80
- target: this.$refs.editorNode,
81
- readonly: this.disabled,
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 [TinyMce Event](https://www.tiny.cloud/docs/advanced/events/).
107
- editor.on(eventName, (event) => this.$emit(eventName, event));
108
- });
109
- }
110
- },
111
- insertImgCallback: async function () {
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
- )
120
- .catch((error) => reject(error));
121
- });
122
- },
123
- },
124
- beforeDestroy() {
125
- window && window.tinymce && window.tinymce.remove(this.editor);
126
- },
127
- watch: {
128
- value(val) {
129
- if (this.editor && this.editor.initialized && val !== this.editorContent) {
130
- this.editorContent = val
131
- this.editor.setContent(val);
132
- }
133
- },
134
- disabled(val) {
135
- if (this.editor && this.editor.initialized) {
136
- this.editor.setMode(val ? "readonly" : "design");
137
- }
138
- },
139
- },
140
- };
141
- </script>
142
-
143
- <style>
144
- .tox-notifications-container,
145
- .tox-statusbar__branding {
146
- display: none;
147
- }
148
- </style>
149
-
150
- <docs>
151
-
152
- ### Defaults
153
-
154
- This is the default [TinyMce configuration](https://www.tiny.cloud/docs/configure/).
155
-
156
- ```js
157
- {
158
- 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',
159
- menubar: 'file edit view insert format tools table help',
160
- 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',
161
- toolbar_sticky: true,
162
- image_advtab: true,
163
- importcss_append: true,
164
- template_cdate_format: '[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]',
165
- template_mdate_format: '[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]',
166
- height: 600,
167
- image_caption: true,
168
- quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote quickimage quicktable',
169
- noneditable_noneditable_class: 'mceNonEditable',
170
- toolbar_mode: 'sliding',
171
- contextmenu: 'link image imagetools table',
172
- skin: useDarkMode ? 'oxide-dark' : 'oxide',
173
- content_css: useDarkMode ? 'dark' : 'default',
174
- content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
175
- }
176
- ```
177
- </docs>
package/layouts/error.vue DELETED
@@ -1,45 +0,0 @@
1
- <template>
2
- <v-app>
3
- <h1 v-if="error.statusCode === 404">
4
- {{ pageNotFound }}
5
- </h1>
6
- <h1 v-else>
7
- {{ otherError }}
8
- </h1>
9
- <NuxtLink to="/">
10
- Home page
11
- </NuxtLink>
12
- <root-components />
13
- </v-app>
14
- </template>
15
-
16
- <script>
17
- export default {
18
- layout: 'empty',
19
- props: {
20
- error: {
21
- type: Object,
22
- default: null
23
- }
24
- },
25
- data () {
26
- return {
27
- pageNotFound: '404 Not Found',
28
- otherError: 'An error occurred'
29
- }
30
- },
31
- head () {
32
- const title =
33
- this.error.statusCode === 404 ? this.pageNotFound : this.otherError
34
- return {
35
- title
36
- }
37
- }
38
- }
39
- </script>
40
-
41
- <style scoped>
42
- h1 {
43
- font-size: 20px;
44
- }
45
- </style>