@mapomodule/uikit 1.0.0-alpha.9 → 2.0.0-beta.1

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 (94) hide show
  1. package/README.md +167 -0
  2. package/dist/index.d.cts +2 -0
  3. package/dist/index.d.mts +2 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.mjs +18 -0
  6. package/dist/module.d.cts +2 -0
  7. package/dist/module.d.mts +2 -0
  8. package/dist/module.d.ts +2 -0
  9. package/dist/module.json +9 -0
  10. package/dist/module.mjs +18 -0
  11. package/dist/types.d.mts +13 -0
  12. package/package.json +63 -10
  13. package/src/index.ts +10 -0
  14. package/src/module.ts +181 -0
  15. package/src/runtime/assets/main.css +59 -0
  16. package/src/runtime/components/MapoConfirmDialog.vue +34 -0
  17. package/src/runtime/components/MapoDetail.vue +861 -0
  18. package/src/runtime/components/MapoDetailLangSwitch.vue +166 -0
  19. package/src/runtime/components/MapoList.vue +339 -0
  20. package/src/runtime/components/MapoListActions.vue +152 -0
  21. package/src/runtime/components/MapoListFilters.vue +289 -0
  22. package/src/runtime/components/MapoListHead.vue +12 -0
  23. package/src/runtime/components/MapoListQuickEdit.vue +163 -0
  24. package/src/runtime/components/MapoListTable.vue +926 -0
  25. package/src/runtime/components/MapoListTabs.vue +48 -0
  26. package/src/runtime/components/MapoLogin.vue +209 -0
  27. package/src/runtime/components/MapoLogoutButton.vue +46 -0
  28. package/src/runtime/components/MapoRootComponents.vue +9 -0
  29. package/src/runtime/components/MapoSidebar.vue +112 -0
  30. package/src/runtime/components/MapoSidebarList.vue +35 -0
  31. package/src/runtime/components/MapoSidebarListItem.vue +79 -0
  32. package/src/runtime/components/MapoSidebarProfile.vue +57 -0
  33. package/src/runtime/components/MapoSnackBar.vue +42 -0
  34. package/src/runtime/components/MapoThemeToggle.vue +23 -0
  35. package/src/runtime/components/MapoTopbar.vue +36 -0
  36. package/src/runtime/layouts/default.vue +53 -0
  37. package/src/runtime/layouts/empty.vue +9 -0
  38. package/src/runtime/page-meta.nuxt.d.ts +45 -0
  39. package/src/runtime/pages/index.vue +14 -0
  40. package/src/runtime/pages/login.vue +7 -0
  41. package/src/runtime/types/list.ts +64 -0
  42. package/CHANGELOG.md +0 -177
  43. package/LICENSE.md +0 -20
  44. package/assets/mixins.scss +0 -22
  45. package/assets/variables.scss +0 -18
  46. package/components/ConfirmDialog.vue +0 -152
  47. package/components/Detail/Detail.vue +0 -566
  48. package/components/Detail/DetailField.vue +0 -142
  49. package/components/Detail/DetailLangSwitch.vue +0 -72
  50. package/components/Detail/defaults.js +0 -57
  51. package/components/DropArea.vue +0 -250
  52. package/components/List/List.vue +0 -254
  53. package/components/List/ListActions.vue +0 -164
  54. package/components/List/ListFilters.vue +0 -334
  55. package/components/List/ListHead.vue +0 -67
  56. package/components/List/ListQuickEdit.vue +0 -302
  57. package/components/List/ListTable.vue +0 -406
  58. package/components/List/ListTabs.vue +0 -65
  59. package/components/Login.vue +0 -124
  60. package/components/Logo.vue +0 -79
  61. package/components/LogoutButton.vue +0 -39
  62. package/components/MediaManager/MediaEditor.vue +0 -309
  63. package/components/MediaManager/MediaFolders.vue +0 -263
  64. package/components/MediaManager/MediaGallery.vue +0 -206
  65. package/components/MediaManager/MediaManager.vue +0 -233
  66. package/components/MediaManager/MediaManagerDialog.vue +0 -96
  67. package/components/MediaManager/MediaPreview.vue +0 -180
  68. package/components/MediaManager/MediaUploader.vue +0 -165
  69. package/components/RootComponents.vue +0 -25
  70. package/components/SnackBar.vue +0 -70
  71. package/components/fields/DateField.vue +0 -74
  72. package/components/fields/FksField.vue +0 -60
  73. package/components/fields/MediaField.vue +0 -213
  74. package/components/fields/MediaM2mField.vue +0 -243
  75. package/components/fields/SeoPreview.vue +0 -89
  76. package/components/fields/wygEditor/defaults.js +0 -55
  77. package/components/fields/wygEditor/utils/events.js +0 -64
  78. package/components/fields/wygEditor/utils/mapomedia.plugin.js +0 -31
  79. package/components/fields/wygEditor/utils/script.injector.js +0 -29
  80. package/components/fields/wygEditor/wygEditor.vue +0 -196
  81. package/components/layout/Sidebar/Sidebar.vue +0 -80
  82. package/components/layout/Sidebar/SidebarFooter.vue +0 -71
  83. package/components/layout/Sidebar/SidebarList.vue +0 -44
  84. package/components/layout/Sidebar/SidebarListItem.vue +0 -144
  85. package/components/layout/Topbar/Topbar.vue +0 -27
  86. package/components/layout/routebuilder.js +0 -48
  87. package/defaults.js +0 -29
  88. package/layouts/default.vue +0 -21
  89. package/layouts/empty.vue +0 -6
  90. package/layouts/error.vue +0 -45
  91. package/module.js +0 -78
  92. package/pages/index.vue +0 -35
  93. package/pages/login.vue +0 -10
  94. package/static/favicon.ico +0 -0
@@ -1,309 +0,0 @@
1
- <template>
2
- <div v-if="media">
3
- <v-container class="px-md-6">
4
- <div class="img_overlay">
5
- <v-btn class="img_overlay__button img_overlay__button--back" small icon @click="close">
6
- <v-icon>mdi-arrow-left</v-icon>
7
- </v-btn>
8
- <v-btn class="img_overlay__button img_overlay__button--href" small icon :href="media.file" target="_blank" >
9
- <v-icon>mdi-open-in-new</v-icon>
10
- </v-btn>
11
- </div>
12
- <MediaPreview
13
- :media="media"
14
- height="400"
15
- contain
16
- filename
17
- media-controls
18
- class="elevation-2"
19
- />
20
- <v-overlay
21
- absolute
22
- v-model="editing"
23
- @click="editing = false"
24
- ></v-overlay>
25
- <div class="dialog">
26
- <div class="dialog__container">
27
- <v-card flat tile class="dialog__content overflow-y-auto"
28
- :class="{ 'py-0': !editing }"
29
- :max-height="editing ? height : '0px'"
30
- >
31
- <v-card-text class="flex-grow-0">
32
- <v-row class="flex-md-row-reverse">
33
- <v-col md="6" cols="12" class="info-media">
34
- <table class="text-caption fill-height pb-md-10">
35
- <tr>
36
- <td class="pr-3"><b>Filename:</b></td>
37
- <td>{{ fileName }}</td>
38
- </tr>
39
- <tr>
40
- <td class="pr-3"><b>Mime type:</b></td>
41
- <td>{{ media.mime_type }}</td>
42
- </tr>
43
- <tr>
44
- <td class="pr-3"><b>Created:</b></td>
45
- <td>{{ dateCreated }}</td>
46
- </tr>
47
- <tr>
48
- <td class="pr-3"><b>Size:</b></td>
49
- <td>{{ fileSize }}</td>
50
- </tr>
51
- <tr>
52
- <td class="pr-3"><b>Url:</b></td>
53
- <td>
54
- <a :href="media.file" target="_blank">{{ media.file }}</a>
55
- </td>
56
- </tr>
57
- <tr>
58
- <td class="pr-3"><b>Linked models:</b></td>
59
- <td>
60
- <ul>
61
- <li v-for="link in media.links" :key="link.id">
62
- <b>{{link.model}} (id:{{link.id}})</b> - {{link.name}}
63
- </li>
64
- </ul>
65
- </td>
66
- </tr>
67
- </table>
68
- </v-col>
69
- <v-col md="6" cols="12">
70
- <v-row>
71
- <v-col sm="6" md="12" cols="12">
72
- <v-text-field
73
- dense
74
- v-model="media.name"
75
- label="Name"
76
- ></v-text-field>
77
- </v-col>
78
- <v-col sm="6" md="12" cols="12">
79
- <v-text-field
80
- dense
81
- v-model="media.title"
82
- label="Title"
83
- ></v-text-field>
84
- </v-col>
85
- <v-col sm="6" md="12" cols="12">
86
- <v-text-field
87
- dense
88
- v-model="media.description"
89
- label="Description"
90
- ></v-text-field>
91
- </v-col>
92
- <v-col sm="6" md="12" cols="12">
93
- <v-text-field
94
- dense
95
- v-model="media.alt_text"
96
- label="Alt name"
97
- ></v-text-field>
98
- </v-col>
99
- <v-col sm="6" md="12" cols="12" class="d-flex align-center">
100
- <div class="d-flex flex-column flex-grow-1">
101
- <v-file-input
102
- v-model="newFile"
103
- :accept="accept"
104
- label="New file"
105
- show-size
106
- dense
107
- prepend-icon
108
- ></v-file-input>
109
- <v-checkbox
110
- v-if="newFile"
111
- v-model="sameUrl"
112
- label="Maintain old url"
113
- class="ma-0"
114
- hide-details
115
- dense
116
- ></v-checkbox>
117
- </div>
118
- <v-img
119
- v-if="newFile && newFilePreview"
120
- :src="newFilePreview"
121
- aspect-ratio="1"
122
- min-width="70px"
123
- max-width="110px"
124
- class="grey lighten-2 ml-3"
125
- >
126
- <template v-slot:placeholder>
127
- <v-row
128
- class="fill-height ma-0"
129
- align="center"
130
- justify="center"
131
- >
132
- <v-progress-circular
133
- indeterminate
134
- color="grey lighten-5"
135
- ></v-progress-circular>
136
- </v-row>
137
- </template>
138
- </v-img>
139
- </v-col>
140
- </v-row>
141
- </v-col>
142
- </v-row>
143
- </v-card-text>
144
- </v-card>
145
- <v-btn
146
- tile
147
- depressed
148
- width="100%"
149
- :class="{ 'pr-0': editing }"
150
- @click="editing = !editing"
151
- >
152
- <span>Edit</span>
153
- <v-icon :style="rotate">mdi-chevron-up</v-icon>
154
- <div class="edit_spacer" :class="{ 'flex-grow-1': editing }"></div>
155
- <v-btn v-if="editing" text tile color="primary" @click="saveMedia">
156
- save
157
- </v-btn>
158
- <v-btn
159
- v-if="editing"
160
- text
161
- tile
162
- color="error"
163
- @click.stop="deleteMedia"
164
- >
165
- delete
166
- </v-btn>
167
- </v-btn>
168
- </div>
169
- </div>
170
- </v-container>
171
- </div>
172
- </template>
173
- <style lang="scss" scoped>
174
- table tr td:nth-child(2) {
175
- overflow-wrap: anywhere;
176
- }
177
- .dialog {
178
- position: relative;
179
- height: 56px;
180
- z-index: 5;
181
- &__container {
182
- position: absolute;
183
- bottom: 0;
184
- width: 100%;
185
- }
186
- &__content {
187
- transition-property: max-height, padding;
188
- transition-duration: 0.3s;
189
- transition-timing-function: ease-out;
190
- }
191
- }
192
- .edit_spacer {
193
- flex-grow: 0;
194
- transition: flex-grow 0.3s ease-out;
195
- }
196
- .img_overlay {
197
- position: relative;
198
- &__button {
199
- position: absolute;
200
- z-index: 1;
201
- color: #333333 !important;
202
- background: #e0e0e096;
203
- top: 10px;
204
- &--back {
205
- left: 10px;
206
- }
207
- &--href {
208
- right: 10px;
209
- }
210
- }
211
- }
212
- </style>
213
- <script>
214
- import { humanFileSize } from "@mapomodule/utils/helpers/formatters";
215
-
216
- export default {
217
- name: "MediaEditor",
218
- data() {
219
- return {
220
- media: null,
221
- editing: false,
222
- newFile: null,
223
- sameUrl: false,
224
- };
225
- },
226
- props: {
227
- value: {
228
- type: Object,
229
- default: () => null,
230
- },
231
- },
232
- computed: {
233
- fileSize() {
234
- return this.media && humanFileSize(this.media.size);
235
- },
236
- dateCreated() {
237
- return this.media && new Date(this.media.created).toLocaleString();
238
- },
239
- fileName() {
240
- return this.media && this.media.file && this.media.file.split("/").pop();
241
- },
242
- rotate() {
243
- return {
244
- transform: this.editing ? "rotate(180deg)" : "rotate(0deg)",
245
- transition: "transform .3s cubic-bezier(0.25, 0.8, 0.5, 1)",
246
- };
247
- },
248
- height() {
249
- switch (this.$vuetify.breakpoint.name) {
250
- case "xs":
251
- return "50vh";
252
- default:
253
- return 425;
254
- }
255
- },
256
- accept(){
257
- switch (this.media.mime_type && this.media.mime_type.split("/")[0]) {
258
- case "image":
259
- return "image/*"
260
- case "video":
261
- return "video/*"
262
- case "audio":
263
- return "audio/*"
264
- default:
265
- return "*"
266
- }
267
- },
268
- newFilePreview() {
269
- return this.newFile.type.startsWith("image/") ? URL.createObjectURL(this.newFile) : null;
270
- },
271
- },
272
- watch: {
273
- value(val) {
274
- this.media = val;
275
- this.editing = false;
276
- this.newFile = null;
277
- this.sameUrl = false;
278
- },
279
- },
280
- methods: {
281
- saveMedia() {
282
- const media = {
283
- id: this.media.id,
284
- name: this.media.name,
285
- title: this.media.title,
286
- description: this.media.description,
287
- alt_text: this.media.alt_text,
288
- file: this.newFile || undefined,
289
- same_url: (this.newFile && this.sameUrl) || undefined,
290
- };
291
- this.newFile = null;
292
- this.sameUrl = false;
293
- this.$emit("updateMedia", media);
294
- },
295
- deleteMedia() {
296
- this.$mapo.$confirm
297
- .open({
298
- title: "Delete",
299
- question: "Are you sure you want to delete this media?",
300
- approveButton: { text: "Delete", attrs: { color: "red", text: true } },
301
- })
302
- .then((res) => res && this.$emit("deleteMedia", this.media));
303
- },
304
- close() {
305
- this.$emit("input", null);
306
- },
307
- },
308
- };
309
- </script>
@@ -1,263 +0,0 @@
1
- <template>
2
- <div>
3
- <div v-if="parentFolders && parentFolders.length">
4
- <span class="mx-2 mt-1 d-flex flex-wrap align-center">
5
- <span class="mb-1">
6
- <v-icon @click="goToFolder()" small>mdi-home</v-icon></span
7
- >
8
- <span class="fpath__button" v-for="(f, i) in parentFolders" :key="i"
9
- >/<a @click="i !== parentFolders.length - 1 && goToFolder(f)">{{
10
- f.slug
11
- }}</a>
12
- </span>
13
- </span>
14
- </div>
15
- <v-card-actions class="flex-wrap">
16
- <div v-if="parentFolder" class="d-none d-sm-block">
17
- <v-btn
18
- class="px-2"
19
- tile
20
- block
21
- text
22
- depressed
23
- @click="goToFolder(updirFolder)"
24
- >
25
- <v-icon> mdi-arrow-left </v-icon>
26
- </v-btn>
27
- </div>
28
- <div
29
- v-for="folder in folders"
30
- :key="folder.id"
31
- class="d-flex child-flex"
32
- :class="{ 'mx-2': expanded }"
33
- >
34
- <div class="folder_grid d-flex flex-column" :class="{ expanded }">
35
- <v-icon @click.stop="goToFolder(folder)" :size="expanded ? 100 : 40">
36
- mdi-folder
37
- </v-icon>
38
-
39
- <div>
40
- <div class="d-flex justify-item-center" :style="hideSlug">
41
- <span class="folder_slug">
42
- {{ folder.title }}
43
- </span>
44
- <v-icon
45
- size="20"
46
- class="folder_grid__editicon ma-0 ml-auto"
47
- @click.stop="createFolder(folder)"
48
- >mdi-pencil</v-icon
49
- >
50
- <v-icon
51
- size="20"
52
- class="folder_grid__editicon ma-0"
53
- @click.stop="deleteFolder(folder)"
54
- >mdi-delete</v-icon
55
- >
56
- </div>
57
- </div>
58
- </div>
59
- </div>
60
- <div class="flex-grow-1 text-center" v-if="!folders.length">
61
- No folders there.. Create a new one!
62
- </div>
63
- <div class="ma-auto mr-2 mb-2">
64
- <v-tooltip disabled left>
65
- <template v-slot:activator="{ on, attrs }">
66
- <v-icon v-bind="attrs" v-on="on" @click.stop="createFolder">
67
- mdi-plus
68
- </v-icon>
69
- </template>
70
- <span>Add folder</span>
71
- </v-tooltip>
72
- <v-tooltip v-if="folders.length" disabled bottom>
73
- <template v-slot:activator="{ on, attrs }">
74
- <v-icon
75
- v-bind="attrs"
76
- v-on="on"
77
- :style="rotate"
78
- @click.prevent="expanded = !expanded"
79
- >
80
- mdi-chevron-down
81
- </v-icon>
82
- </template>
83
- <span>{{ expanded ? "Collapse" : "Expand" }} view</span>
84
- </v-tooltip>
85
- </div>
86
- </v-card-actions>
87
- <v-progress-linear
88
- :active="loading"
89
- indeterminate
90
- height="2"
91
- ></v-progress-linear>
92
-
93
- <v-divider></v-divider>
94
- <v-dialog v-model="dialog" max-width="300px">
95
- <v-card>
96
- <v-card-title>
97
- {{ folderEdit.id ? "Edit Folder" : "New Folder" }}
98
- </v-card-title>
99
-
100
- <v-card-text>
101
- <v-container>
102
- <v-row>
103
- <v-col cols="12">
104
- <v-text-field
105
- v-model="folderEdit.title"
106
- label="Folder name"
107
- ></v-text-field>
108
- </v-col>
109
- </v-row>
110
- </v-container>
111
- </v-card-text>
112
-
113
- <v-card-actions>
114
- <v-spacer></v-spacer>
115
- <v-btn color="primary" text @click="closeEdit"> Cancel </v-btn>
116
- <v-btn color="primary" text @click="saveFolder"> Save </v-btn>
117
- </v-card-actions>
118
- </v-card>
119
- </v-dialog>
120
- </div>
121
- </template>
122
- <style lang="scss" scoped>
123
- .folder_grid {
124
- .folder_slug {
125
- width: 65px;
126
- display: inline-block;
127
- white-space: nowrap;
128
- overflow: hidden;
129
- text-overflow: ellipsis;
130
- text-align: center;
131
- line-height: 20px;
132
- }
133
- &__editicon {
134
- display: none;
135
- }
136
- &.expanded {
137
- .folder_slug {
138
- text-align: left;
139
- padding-left: 5px;
140
- }
141
- .folder_grid__editicon {
142
- display: block;
143
- }
144
- }
145
- }
146
-
147
- .fpath__button {
148
- padding-left: 7px;
149
- color: grey;
150
- a {
151
- margin-left: 7px;
152
- }
153
- &:last-child {
154
- a {
155
- color: unset;
156
- cursor: auto;
157
- }
158
- }
159
- }
160
- </style>
161
-
162
- <script>
163
- export default {
164
- name: "MediaFolders",
165
- data() {
166
- return {
167
- expanded: false,
168
- dialog: false,
169
- folderEdit: {},
170
- actions: [
171
- {
172
- label: "Create folder",
173
- action: this.createFolder
174
- }
175
- ]
176
- };
177
- },
178
- props: {
179
- loading: Boolean,
180
- folders: {
181
- type: Array,
182
- default: () => []
183
- },
184
- parentFolders: {
185
- type: Array,
186
- default: () => []
187
- }
188
- },
189
- methods: {
190
- goToFolder(folder) {
191
- this.$emit("goToFolder", folder);
192
- },
193
- createFolder(folder) {
194
- this.folderEdit = Object.assign(
195
- { updir: this.parentFolder && this.parentFolder.id },
196
- folder
197
- );
198
- this.dialog = true;
199
- },
200
- deleteFolder(folder) {
201
- this.$mapo.$confirm
202
- .open({
203
- title: "Delete",
204
- question: "Are you sure to delelete this folder and all its content?",
205
- approveButton: { text: "Delete", attrs: { color: "red", text: true } }
206
- })
207
- .then(res => res && this.$emit("deleteFolder", folder));
208
- },
209
- saveFolder() {
210
- this.folderEdit.slug = this.slugify(this.folderEdit.title);
211
- this.$emit("updateFolder", this.folderEdit);
212
- this.closeEdit();
213
- },
214
- closeEdit() {
215
- this.dialog = false;
216
- this.folderEdit = {};
217
- },
218
- slugify(text) {
219
- return text
220
- .toString()
221
- .toLowerCase()
222
- .replace(/\s+/g, "-") // Replace spaces with -
223
- .replace(/[^\w\-]+/g, "") // Remove all non-word chars
224
- .replace(/\-\-+/g, "-") // Replace multiple - with single -
225
- .replace(/^-+/, "") // Trim - from start of text
226
- .replace(/-+$/, ""); // Trim - from end of text
227
- }
228
- },
229
- computed: {
230
- rotate() {
231
- return {
232
- transform: this.expanded ? "rotate(180deg)" : "rotate(0deg)",
233
- transition: "transform .3s cubic-bezier(0.25, 0.8, 0.5, 1)"
234
- };
235
- },
236
- hideSlug() {
237
- return {
238
- maxWidth: this.expanded ? "105px" : "50px",
239
- maxHeight: this.expanded ? "24px" : "18px",
240
- opacity: this.expanded ? 0.8 : 0.8,
241
- transform: this.expanded ? "scale(1)" : "scale(0.7)",
242
- transition: "all .3s cubic-bezier(0.25, 0.8, 0.5, 1)"
243
- };
244
- },
245
- parentFolder() {
246
- return (
247
- (this.parentFolders &&
248
- this.parentFolders.length > 0 &&
249
- this.parentFolders[this.parentFolders.length - 1]) ||
250
- null
251
- );
252
- },
253
- updirFolder() {
254
- return (
255
- (this.parentFolders &&
256
- this.parentFolders.length > 1 &&
257
- this.parentFolders[this.parentFolders.length - 2]) ||
258
- null
259
- );
260
- }
261
- }
262
- };
263
- </script>