@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.
- package/README.md +167 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +18 -0
- package/dist/module.d.cts +2 -0
- package/dist/module.d.mts +2 -0
- package/dist/module.d.ts +2 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +18 -0
- package/dist/types.d.mts +13 -0
- package/package.json +63 -10
- package/src/index.ts +10 -0
- package/src/module.ts +181 -0
- package/src/runtime/assets/main.css +59 -0
- package/src/runtime/components/MapoConfirmDialog.vue +34 -0
- package/src/runtime/components/MapoDetail.vue +861 -0
- package/src/runtime/components/MapoDetailLangSwitch.vue +166 -0
- package/src/runtime/components/MapoList.vue +339 -0
- package/src/runtime/components/MapoListActions.vue +152 -0
- package/src/runtime/components/MapoListFilters.vue +289 -0
- package/src/runtime/components/MapoListHead.vue +12 -0
- package/src/runtime/components/MapoListQuickEdit.vue +163 -0
- package/src/runtime/components/MapoListTable.vue +926 -0
- package/src/runtime/components/MapoListTabs.vue +48 -0
- package/src/runtime/components/MapoLogin.vue +209 -0
- package/src/runtime/components/MapoLogoutButton.vue +46 -0
- package/src/runtime/components/MapoRootComponents.vue +9 -0
- package/src/runtime/components/MapoSidebar.vue +112 -0
- package/src/runtime/components/MapoSidebarList.vue +35 -0
- package/src/runtime/components/MapoSidebarListItem.vue +79 -0
- package/src/runtime/components/MapoSidebarProfile.vue +57 -0
- package/src/runtime/components/MapoSnackBar.vue +42 -0
- package/src/runtime/components/MapoThemeToggle.vue +23 -0
- package/src/runtime/components/MapoTopbar.vue +36 -0
- package/src/runtime/layouts/default.vue +53 -0
- package/src/runtime/layouts/empty.vue +9 -0
- package/src/runtime/page-meta.nuxt.d.ts +45 -0
- package/src/runtime/pages/index.vue +14 -0
- package/src/runtime/pages/login.vue +7 -0
- package/src/runtime/types/list.ts +64 -0
- package/CHANGELOG.md +0 -177
- package/LICENSE.md +0 -20
- package/assets/mixins.scss +0 -22
- package/assets/variables.scss +0 -18
- package/components/ConfirmDialog.vue +0 -152
- package/components/Detail/Detail.vue +0 -566
- package/components/Detail/DetailField.vue +0 -142
- package/components/Detail/DetailLangSwitch.vue +0 -72
- package/components/Detail/defaults.js +0 -57
- package/components/DropArea.vue +0 -250
- package/components/List/List.vue +0 -254
- package/components/List/ListActions.vue +0 -164
- package/components/List/ListFilters.vue +0 -334
- package/components/List/ListHead.vue +0 -67
- package/components/List/ListQuickEdit.vue +0 -302
- package/components/List/ListTable.vue +0 -406
- package/components/List/ListTabs.vue +0 -65
- package/components/Login.vue +0 -124
- package/components/Logo.vue +0 -79
- package/components/LogoutButton.vue +0 -39
- package/components/MediaManager/MediaEditor.vue +0 -309
- package/components/MediaManager/MediaFolders.vue +0 -263
- package/components/MediaManager/MediaGallery.vue +0 -206
- package/components/MediaManager/MediaManager.vue +0 -233
- package/components/MediaManager/MediaManagerDialog.vue +0 -96
- package/components/MediaManager/MediaPreview.vue +0 -180
- package/components/MediaManager/MediaUploader.vue +0 -165
- package/components/RootComponents.vue +0 -25
- package/components/SnackBar.vue +0 -70
- package/components/fields/DateField.vue +0 -74
- package/components/fields/FksField.vue +0 -60
- package/components/fields/MediaField.vue +0 -213
- package/components/fields/MediaM2mField.vue +0 -243
- package/components/fields/SeoPreview.vue +0 -89
- package/components/fields/wygEditor/defaults.js +0 -55
- package/components/fields/wygEditor/utils/events.js +0 -64
- package/components/fields/wygEditor/utils/mapomedia.plugin.js +0 -31
- package/components/fields/wygEditor/utils/script.injector.js +0 -29
- package/components/fields/wygEditor/wygEditor.vue +0 -196
- package/components/layout/Sidebar/Sidebar.vue +0 -80
- package/components/layout/Sidebar/SidebarFooter.vue +0 -71
- package/components/layout/Sidebar/SidebarList.vue +0 -44
- package/components/layout/Sidebar/SidebarListItem.vue +0 -144
- package/components/layout/Topbar/Topbar.vue +0 -27
- package/components/layout/routebuilder.js +0 -48
- package/defaults.js +0 -29
- package/layouts/default.vue +0 -21
- package/layouts/empty.vue +0 -6
- package/layouts/error.vue +0 -45
- package/module.js +0 -78
- package/pages/index.vue +0 -35
- package/pages/login.vue +0 -10
- package/static/favicon.ico +0 -0
|
@@ -1,406 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<v-data-table
|
|
4
|
-
v-model="selection"
|
|
5
|
-
v-bind="$attrs"
|
|
6
|
-
:items="serverPaginationEnabled ? items : filteredItems"
|
|
7
|
-
:loading="loading"
|
|
8
|
-
:options.sync="options"
|
|
9
|
-
:search="searchString"
|
|
10
|
-
:server-items-length="serverItemsLength"
|
|
11
|
-
:class="{ mapo__listtable__all_selected: selectAll }"
|
|
12
|
-
:item-key="lookup"
|
|
13
|
-
>
|
|
14
|
-
<template v-slot:top>
|
|
15
|
-
<v-toolbar flat>
|
|
16
|
-
<v-text-field
|
|
17
|
-
v-if="searchable"
|
|
18
|
-
v-model="searchString"
|
|
19
|
-
@input="
|
|
20
|
-
loadingSearch = serverPaginationEnabled;
|
|
21
|
-
search();
|
|
22
|
-
"
|
|
23
|
-
prepend-inner-icon="mdi-magnify"
|
|
24
|
-
label="Search"
|
|
25
|
-
single-line
|
|
26
|
-
hide-details
|
|
27
|
-
outlined
|
|
28
|
-
dense
|
|
29
|
-
clearable
|
|
30
|
-
:loading="loadingSearch"
|
|
31
|
-
class="search-input rounded-0"
|
|
32
|
-
></v-text-field>
|
|
33
|
-
<v-spacer></v-spacer>
|
|
34
|
-
<slot name="dtable.top.center"></slot>
|
|
35
|
-
<v-spacer></v-spacer>
|
|
36
|
-
<v-btn text v-if="quickModeEnabled && userCan('add')" class="ml-2" @click="quickAction()">
|
|
37
|
-
<v-icon small left class="d-none d-sm-block mr-2"> mdi-plus </v-icon>
|
|
38
|
-
<span class="d-none d-sm-block">Quick</span> add
|
|
39
|
-
</v-btn>
|
|
40
|
-
<v-btn v-if="serverPaginationEnabled" class=" mx-sm-2 ma-2 mx-0" @click="getDataFromApi(false)" icon>
|
|
41
|
-
<v-icon>mdi-update</v-icon>
|
|
42
|
-
</v-btn>
|
|
43
|
-
</v-toolbar>
|
|
44
|
-
<slot name="dtable.top.under"></slot>
|
|
45
|
-
</template>
|
|
46
|
-
<template v-if="navigable" v-slot:[`item.${firstColName}`]="{ item }">
|
|
47
|
-
<NuxtLink :to="detailLink(item)">
|
|
48
|
-
{{ item[firstColName] }}
|
|
49
|
-
</NuxtLink>
|
|
50
|
-
</template>
|
|
51
|
-
<template v-slot:item.data-table-select="{ isSelected, select }" v-if="selectAll">
|
|
52
|
-
<v-simple-checkbox v-model="selectAll" @input="select"></v-simple-checkbox>
|
|
53
|
-
</template>
|
|
54
|
-
<template v-slot:header.data-table-select="{ on, props }" v-if="selectAll">
|
|
55
|
-
<v-simple-checkbox v-model="selectAll" @input="on.input"></v-simple-checkbox>
|
|
56
|
-
</template>
|
|
57
|
-
<template v-slot:[`item.actions`]="{ item }">
|
|
58
|
-
<v-icon :disabled="!userCan('change')" v-if="quickModeEnabled" small class="mr-2" @click="quickAction(item)">
|
|
59
|
-
mdi-pencil
|
|
60
|
-
</v-icon>
|
|
61
|
-
<v-icon :disabled="!userCan('delete')" small @click="deleteItem(item)"> mdi-delete </v-icon>
|
|
62
|
-
</template>
|
|
63
|
-
<template v-for="slot in nameSpacedSlots($slots, 'dtable.')" :slot="slot">
|
|
64
|
-
<slot :name="`dtable.${slot}`"></slot>
|
|
65
|
-
</template>
|
|
66
|
-
<template
|
|
67
|
-
v-for="slot in nameSpacedSlots($scopedSlots, 'dtable.')"
|
|
68
|
-
v-slot:[slot]="props"
|
|
69
|
-
>
|
|
70
|
-
<slot :name="`dtable.${slot}`" v-bind="props" />
|
|
71
|
-
</template>
|
|
72
|
-
</v-data-table>
|
|
73
|
-
<list-quick-edit
|
|
74
|
-
v-if="quickModeEnabled"
|
|
75
|
-
ref="editModal"
|
|
76
|
-
:offline="offlineMode"
|
|
77
|
-
v-bind="{ ...$attrs, value: false, crud, lookup: lookup }"
|
|
78
|
-
>
|
|
79
|
-
<template v-for="slot in nameSpacedSlots($slots, 'qedit.')" :slot="slot">
|
|
80
|
-
<slot :name="`qedit.${slot}`"></slot>
|
|
81
|
-
</template>
|
|
82
|
-
<template v-for="slot in nameSpacedSlots($scopedSlots, 'qedit.')" v-slot:[slot]="props">
|
|
83
|
-
<slot :name="`qedit.${slot}`" v-bind="props" />
|
|
84
|
-
</template>
|
|
85
|
-
</list-quick-edit>
|
|
86
|
-
</div>
|
|
87
|
-
</template>
|
|
88
|
-
|
|
89
|
-
<style lang="scss" scoped>
|
|
90
|
-
.mapo__listtable__all_selected {
|
|
91
|
-
.v-data-table__selected {
|
|
92
|
-
background: none !important;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
.search-input{
|
|
96
|
-
max-width: 300px;
|
|
97
|
-
@media (max-width: 400px) {
|
|
98
|
-
&.v-input--is-focused{
|
|
99
|
-
position: absolute;
|
|
100
|
-
z-index: 1;
|
|
101
|
-
width: calc(100% - 32px);
|
|
102
|
-
&.theme--dark{
|
|
103
|
-
background: #272727;
|
|
104
|
-
}
|
|
105
|
-
&.theme--light{
|
|
106
|
-
background: #fff;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
</style>
|
|
112
|
-
|
|
113
|
-
<script>
|
|
114
|
-
import { getPointed } from "@mapomodule/utils/helpers/objHelpers";
|
|
115
|
-
import { debounce } from "@mapomodule/utils/helpers/debounce";
|
|
116
|
-
|
|
117
|
-
export default {
|
|
118
|
-
name: "ListTable",
|
|
119
|
-
data: () => ({
|
|
120
|
-
items: [],
|
|
121
|
-
loading: true,
|
|
122
|
-
selection: [],
|
|
123
|
-
selectAll: false,
|
|
124
|
-
options: {},
|
|
125
|
-
httpPaginator: {},
|
|
126
|
-
searchString: "",
|
|
127
|
-
loadingSearch: false,
|
|
128
|
-
noPagination: false,
|
|
129
|
-
}),
|
|
130
|
-
props: {
|
|
131
|
-
crud: {
|
|
132
|
-
type: Object,
|
|
133
|
-
required: true
|
|
134
|
-
},
|
|
135
|
-
serverPagination: Boolean,
|
|
136
|
-
navigable: Boolean,
|
|
137
|
-
lookup: {
|
|
138
|
-
type: String,
|
|
139
|
-
default: "id",
|
|
140
|
-
},
|
|
141
|
-
detailLink: {
|
|
142
|
-
type: Function,
|
|
143
|
-
default(item) {
|
|
144
|
-
return { path: `${this.$route.path}/${item[this.lookup]}` };
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
filters: {
|
|
148
|
-
type: Array,
|
|
149
|
-
default: () => [],
|
|
150
|
-
},
|
|
151
|
-
searchable: {
|
|
152
|
-
type: Boolean,
|
|
153
|
-
default: false,
|
|
154
|
-
},
|
|
155
|
-
data: {
|
|
156
|
-
type: Array,
|
|
157
|
-
required: false
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
watch: {
|
|
161
|
-
selection(val) {
|
|
162
|
-
this.$emit("input", val);
|
|
163
|
-
},
|
|
164
|
-
selectAll(val) {
|
|
165
|
-
this.$emit("input", val ? "all" : this.selection);
|
|
166
|
-
},
|
|
167
|
-
filters: {
|
|
168
|
-
deep: true,
|
|
169
|
-
handler() {
|
|
170
|
-
this.serverPaginationEnabled && this.getDataFromApi();
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
options: {
|
|
174
|
-
deep: true,
|
|
175
|
-
handler(options) {
|
|
176
|
-
this.noPagination = options.itemsPerPage === -1;
|
|
177
|
-
this.setQparams(options);
|
|
178
|
-
this.serverPaginationEnabled && this.getDataFromApi(false);
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
noPagination() {
|
|
182
|
-
this.getDataFromApi();
|
|
183
|
-
},
|
|
184
|
-
data: {
|
|
185
|
-
deep: true,
|
|
186
|
-
handler(data) {
|
|
187
|
-
if (data) this.items = data;
|
|
188
|
-
},
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
methods: {
|
|
192
|
-
getDataFromApi(clearSelection = true) {
|
|
193
|
-
if (clearSelection) {
|
|
194
|
-
this.selection = [];
|
|
195
|
-
this.selectAll = false;
|
|
196
|
-
}
|
|
197
|
-
this.loading = !this.offlineMode;
|
|
198
|
-
!this.offlineMode && this.debouncedDataFromApi();
|
|
199
|
-
},
|
|
200
|
-
debouncedDataFromApi: debounce(function () {
|
|
201
|
-
return new Promise((resolve, reject) => {
|
|
202
|
-
this.selection = [];
|
|
203
|
-
if (!this.serverPaginationEnabled) {
|
|
204
|
-
this.crud
|
|
205
|
-
.list()
|
|
206
|
-
.then((data) => {
|
|
207
|
-
this.items = data;
|
|
208
|
-
this.loading = false;
|
|
209
|
-
this.httpPaginator = {};
|
|
210
|
-
resolve(data);
|
|
211
|
-
})
|
|
212
|
-
.catch((error) => reject(error));
|
|
213
|
-
} else {
|
|
214
|
-
const params = this.getHttpParams();
|
|
215
|
-
this.crud
|
|
216
|
-
.list({ params })
|
|
217
|
-
.then((data) => {
|
|
218
|
-
this.items = data.items;
|
|
219
|
-
this.httpPaginator = data.paginator;
|
|
220
|
-
this.loading = false;
|
|
221
|
-
resolve(data);
|
|
222
|
-
})
|
|
223
|
-
.catch((error) => reject(error));
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
}, 500),
|
|
227
|
-
setQparams(options) {
|
|
228
|
-
this.$router.push({
|
|
229
|
-
query: {
|
|
230
|
-
...this.$route.query,
|
|
231
|
-
...this.getOrderParams(options),
|
|
232
|
-
},
|
|
233
|
-
});
|
|
234
|
-
},
|
|
235
|
-
restoreFromQparams() {
|
|
236
|
-
this.options = {
|
|
237
|
-
...this.options,
|
|
238
|
-
sortBy:
|
|
239
|
-
this.$route.query.sort?.split(",").map((p) => p.replace(/^-/, "")) ||
|
|
240
|
-
this.options.sortBy ||
|
|
241
|
-
[],
|
|
242
|
-
sortDesc:
|
|
243
|
-
this.$route.query.order?.split(",").map((p) => p.startsWith("-")) ||
|
|
244
|
-
this.options.sortDesc ||
|
|
245
|
-
[],
|
|
246
|
-
itemsPerPage:
|
|
247
|
-
parseInt(this.$route.query.items) || this.options.itemsPerPage || 10,
|
|
248
|
-
page: parseInt(this.$route.query.page) || this.options.page || 1,
|
|
249
|
-
};
|
|
250
|
-
this.searchString = this.$route.query.search;
|
|
251
|
-
},
|
|
252
|
-
getOrderParams(options) {
|
|
253
|
-
const { sortBy, sortDesc, page, itemsPerPage } = options;
|
|
254
|
-
const sort =
|
|
255
|
-
sortBy.map((field, i) => (sortDesc[i] ? "-" : "") + field).join(",") || undefined;
|
|
256
|
-
return { sort, items: itemsPerPage, page: page !== 1 ? page : undefined };
|
|
257
|
-
},
|
|
258
|
-
getHttpParams() {
|
|
259
|
-
const params = new URLSearchParams();
|
|
260
|
-
for (const [key, value] of Object.entries(this.getOrderParams(this.options))) {
|
|
261
|
-
value !== undefined && params.append(key, value);
|
|
262
|
-
}
|
|
263
|
-
this.filters.forEach((fi) => {
|
|
264
|
-
const query = [];
|
|
265
|
-
const format = (val) => val.replaceAll(".", "__");
|
|
266
|
-
if (fi.datepicker) {
|
|
267
|
-
const dates = fi.active[0].value.split(",");
|
|
268
|
-
query.push(
|
|
269
|
-
`${format(fi.value)}__gte=${dates[0]}`,
|
|
270
|
-
`${format(fi.value)}__lte=${dates[1]}`
|
|
271
|
-
);
|
|
272
|
-
} else if (fi.active.length > 1) {
|
|
273
|
-
query.push(`${format(fi.value)}=[${fi.active.map((a) => a.value).join(",")}]`);
|
|
274
|
-
} else {
|
|
275
|
-
query.push(`${format(fi.value)}=${fi.active[0].value}`);
|
|
276
|
-
}
|
|
277
|
-
query.forEach((q) => params.append("fltr", q));
|
|
278
|
-
});
|
|
279
|
-
if (this.searchString && this.searchable) params.append("search", this.searchString);
|
|
280
|
-
return params;
|
|
281
|
-
},
|
|
282
|
-
quickAction(item) {
|
|
283
|
-
this.$refs.editModal.open(item).then((r) => {
|
|
284
|
-
if (!r) return;
|
|
285
|
-
if (!this.offlineMode) {
|
|
286
|
-
this.getDataFromApi();
|
|
287
|
-
} else {
|
|
288
|
-
let index = item ? this.items.findIndex((i) => i[this.lookup] === item[this.lookup]) : -1;
|
|
289
|
-
let update = true;
|
|
290
|
-
|
|
291
|
-
if (index !== -1) {
|
|
292
|
-
this.items.splice(index, 1, r);
|
|
293
|
-
} else {
|
|
294
|
-
index = this.items.push(r);
|
|
295
|
-
update = false;
|
|
296
|
-
}
|
|
297
|
-
this.$emit("update:data", this.items, r, index);
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
},
|
|
301
|
-
deleteItem(item) {
|
|
302
|
-
const callback = (item) => {
|
|
303
|
-
if (!this.offlineMode) {
|
|
304
|
-
this.crud.delete(item[this.lookup]).then(this.getDataFromApi);
|
|
305
|
-
} else {
|
|
306
|
-
const index = this.items.findIndex((i) => i[this.lookup] === item[this.lookup]);
|
|
307
|
-
|
|
308
|
-
if (index !== -1) {
|
|
309
|
-
this.items.splice(index, 1);
|
|
310
|
-
this.$emit("update:data", this.items, r, index);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
this.$mapo.$confirm
|
|
316
|
-
.open({
|
|
317
|
-
title: "Delete",
|
|
318
|
-
question: "Are you sure you want to delete this item?",
|
|
319
|
-
approveButton: { text: "Delete", attrs: { color: "red", text: true } },
|
|
320
|
-
})
|
|
321
|
-
.then((res) => (res ? callback(item) : null));
|
|
322
|
-
},
|
|
323
|
-
nameSpacedSlots(slots, scope) {
|
|
324
|
-
return Object.keys(slots)
|
|
325
|
-
.filter((name) => name.startsWith(scope))
|
|
326
|
-
.map((name) => name.replace(scope, ""));
|
|
327
|
-
},
|
|
328
|
-
toggleSelectAll() {
|
|
329
|
-
this.selectAll = !this.selectAll;
|
|
330
|
-
},
|
|
331
|
-
search: debounce(function () {
|
|
332
|
-
this.$router.push({
|
|
333
|
-
query: {
|
|
334
|
-
...this.$route.query,
|
|
335
|
-
search: this.searchString || undefined,
|
|
336
|
-
},
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
this.serverPaginationEnabled && this.getDataFromApi();
|
|
340
|
-
this.loadingSearch = false;
|
|
341
|
-
}, 1000),
|
|
342
|
-
userCan(action) {
|
|
343
|
-
if (this.$mapo.$auth.routeMiddlewares.includes("permissions")){
|
|
344
|
-
return this.$mapo.$auth.user.permissions.includes(action)
|
|
345
|
-
}
|
|
346
|
-
return true
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
computed: {
|
|
350
|
-
filteredItems() {
|
|
351
|
-
return this.filters.reduce(
|
|
352
|
-
(result, filter) => {
|
|
353
|
-
let handler;
|
|
354
|
-
if (filter.datepicker) {
|
|
355
|
-
handler = (el, filter) => (choice) => {
|
|
356
|
-
let date = getPointed(el, filter.value, ""),
|
|
357
|
-
dateObj = date && new Date(date).getTime(),
|
|
358
|
-
range = choice.value.split(",").map((v, i) => {
|
|
359
|
-
let d = new Date(v);
|
|
360
|
-
d.setDate(d.getDate() + i);
|
|
361
|
-
return d;
|
|
362
|
-
});
|
|
363
|
-
return dateObj && dateObj >= range[0] && dateObj <= range[1];
|
|
364
|
-
};
|
|
365
|
-
} else {
|
|
366
|
-
handler = (el, filter) => (choice) =>
|
|
367
|
-
getPointed(el, filter.value, "") === choice.value;
|
|
368
|
-
}
|
|
369
|
-
return result.filter((el) => filter.active.some(handler(el, filter)));
|
|
370
|
-
},
|
|
371
|
-
[...this.items]
|
|
372
|
-
);
|
|
373
|
-
},
|
|
374
|
-
firstColName() {
|
|
375
|
-
return (
|
|
376
|
-
this.$attrs.headers && this.$attrs.headers.length && this.$attrs.headers[0].value
|
|
377
|
-
);
|
|
378
|
-
},
|
|
379
|
-
quickModeEnabled() {
|
|
380
|
-
return (
|
|
381
|
-
this.nameSpacedSlots(this.$slots, "qedit.body").length ||
|
|
382
|
-
this.nameSpacedSlots(this.$scopedSlots, "qedit.body").length ||
|
|
383
|
-
(this.$attrs.editFields && this.$attrs.editFields.length)
|
|
384
|
-
);
|
|
385
|
-
},
|
|
386
|
-
serverPaginationEnabled() {
|
|
387
|
-
return this.serverPagination && !this.noPagination && !this.offlineMode;
|
|
388
|
-
},
|
|
389
|
-
offlineMode() {
|
|
390
|
-
return !!this.data;
|
|
391
|
-
},
|
|
392
|
-
serverItemsLength() {
|
|
393
|
-
return this.httpPaginator.count || (this.serverPaginationEnabled && (this.options.page * this.options.itemsPerPage)) || -1;
|
|
394
|
-
},
|
|
395
|
-
},
|
|
396
|
-
mounted() {
|
|
397
|
-
this.restoreFromQparams();
|
|
398
|
-
if (!this.offlineMode) {
|
|
399
|
-
this.getDataFromApi();
|
|
400
|
-
} else {
|
|
401
|
-
this.items = this.data;
|
|
402
|
-
this.loading = false;
|
|
403
|
-
}
|
|
404
|
-
},
|
|
405
|
-
};
|
|
406
|
-
</script>
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="list__tabs">
|
|
3
|
-
<div class="list__tabs__item" v-bind:class="{ active: tabActive==1 }">Tutto (6)</div>
|
|
4
|
-
<div class="list__tabs__item" v-bind:class="{ active: tabActive==2 }">Pubblicato (12)</div>
|
|
5
|
-
<div class="list__tabs__item" v-bind:class="{ active: tabActive==3 }">Cestinato (2)</div>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<style lang="scss" scoped>
|
|
10
|
-
@import "@mapomodule/uikit/assets/variables.scss";
|
|
11
|
-
|
|
12
|
-
.list {
|
|
13
|
-
&__tabs {
|
|
14
|
-
display: flex;
|
|
15
|
-
justify-content: flex-start;
|
|
16
|
-
align-items: center;
|
|
17
|
-
margin-bottom: 1rem;
|
|
18
|
-
&__item {
|
|
19
|
-
font-weight: 400;
|
|
20
|
-
margin-right: 1rem;
|
|
21
|
-
position: relative;
|
|
22
|
-
cursor: pointer;
|
|
23
|
-
&.active {
|
|
24
|
-
font-weight: bold;
|
|
25
|
-
}
|
|
26
|
-
&:after {
|
|
27
|
-
content: "";
|
|
28
|
-
position: absolute;
|
|
29
|
-
right: -0.5rem;
|
|
30
|
-
top: 20%;
|
|
31
|
-
width: 1px;
|
|
32
|
-
height: 60%;
|
|
33
|
-
background: $b-1;
|
|
34
|
-
}
|
|
35
|
-
&:last-child {
|
|
36
|
-
&:after {
|
|
37
|
-
display: none;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
</style>
|
|
44
|
-
|
|
45
|
-
<script>
|
|
46
|
-
export default {
|
|
47
|
-
name: "ListTabs",
|
|
48
|
-
data() {
|
|
49
|
-
return {};
|
|
50
|
-
},
|
|
51
|
-
props: {
|
|
52
|
-
tabActive: Number
|
|
53
|
-
},
|
|
54
|
-
mounted: function () {
|
|
55
|
-
document.querySelectorAll('.list__tabs__item').forEach(element => {
|
|
56
|
-
element.addEventListener('click', () => {
|
|
57
|
-
if(!element.classList.contains('active')) {
|
|
58
|
-
document.querySelector('.list__tabs__item.active').classList.remove('active')
|
|
59
|
-
element.classList.add('active')
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
</script>
|
package/components/Login.vue
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="login__wrapper">
|
|
3
|
-
<div class="login__inner">
|
|
4
|
-
<h2 class="login__inner__title">Login</h2>
|
|
5
|
-
|
|
6
|
-
<div class="login__form__outer">
|
|
7
|
-
<v-form
|
|
8
|
-
@submit.prevent="handleLogin(username, password)"
|
|
9
|
-
class="login__form"
|
|
10
|
-
>
|
|
11
|
-
<v-text-field
|
|
12
|
-
class="rounded-0"
|
|
13
|
-
v-model="username"
|
|
14
|
-
label="Username"
|
|
15
|
-
required
|
|
16
|
-
outlined
|
|
17
|
-
filled
|
|
18
|
-
dense
|
|
19
|
-
light
|
|
20
|
-
:error-messages="errors.username"
|
|
21
|
-
></v-text-field>
|
|
22
|
-
<v-text-field
|
|
23
|
-
class="rounded-0"
|
|
24
|
-
v-model="password"
|
|
25
|
-
label="Password"
|
|
26
|
-
:append-icon="showPass ? 'mdi-eye' : 'mdi-eye-off'"
|
|
27
|
-
@click:append="showPass = !showPass"
|
|
28
|
-
required
|
|
29
|
-
outlined
|
|
30
|
-
dense
|
|
31
|
-
filled
|
|
32
|
-
light
|
|
33
|
-
:error-messages="errors.password"
|
|
34
|
-
:type="showPass ? 'text' : 'password'"
|
|
35
|
-
></v-text-field>
|
|
36
|
-
<div class="text-center">
|
|
37
|
-
<v-btn type="submit" class="rounded-0" elevation="0" dark>
|
|
38
|
-
Log In
|
|
39
|
-
</v-btn>
|
|
40
|
-
<v-messages
|
|
41
|
-
v-model="errors.non_field_errors"
|
|
42
|
-
color="error"
|
|
43
|
-
class="mt-4 text-center"
|
|
44
|
-
/>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
</v-form>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</template>
|
|
52
|
-
<script>
|
|
53
|
-
export default {
|
|
54
|
-
data() {
|
|
55
|
-
return {
|
|
56
|
-
username: "",
|
|
57
|
-
password: null,
|
|
58
|
-
showPass: false,
|
|
59
|
-
errors: {}
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
watch: {
|
|
63
|
-
$route: {
|
|
64
|
-
handler: function (route) {
|
|
65
|
-
const query = route.query;
|
|
66
|
-
if (query) {
|
|
67
|
-
this.redirect = query.redirect;
|
|
68
|
-
this.otherQuery = Object.keys(query).reduce((acc, cur) => {
|
|
69
|
-
if (cur !== "redirect") {
|
|
70
|
-
acc[cur] = query[cur];
|
|
71
|
-
}
|
|
72
|
-
return acc;
|
|
73
|
-
}, {});
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
immediate: true,
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
methods: {
|
|
80
|
-
handleLogin(username, password) {
|
|
81
|
-
this.$mapo.$auth
|
|
82
|
-
.login({ username, password })
|
|
83
|
-
.then(() =>
|
|
84
|
-
this.$router.push({
|
|
85
|
-
path: this.redirect || "/",
|
|
86
|
-
query: this.otherQuery,
|
|
87
|
-
})
|
|
88
|
-
)
|
|
89
|
-
.catch((error) => {
|
|
90
|
-
this.errors = error.response?.data || {}
|
|
91
|
-
if (!Object.keys(this.errors).length){
|
|
92
|
-
this.$mapo.$snack.open({message: "Cannot login right now. Try again later.", color: "error"})
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
</script>
|
|
99
|
-
<style lang="scss">
|
|
100
|
-
@import "@mapomodule/uikit/assets/variables.scss";
|
|
101
|
-
.login {
|
|
102
|
-
&__wrapper {
|
|
103
|
-
display: flex;
|
|
104
|
-
align-items: center;
|
|
105
|
-
justify-content: center;
|
|
106
|
-
background: $w-1;
|
|
107
|
-
color: $black;
|
|
108
|
-
height: 100%;
|
|
109
|
-
}
|
|
110
|
-
&__inner {
|
|
111
|
-
padding: 1rem;
|
|
112
|
-
width: 300px;
|
|
113
|
-
&__title {
|
|
114
|
-
font-size: 2rem;
|
|
115
|
-
border-bottom: 2px solid $black;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
&__form {
|
|
119
|
-
&__outer {
|
|
120
|
-
margin-top: 1rem;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
</style>
|
package/components/Logo.vue
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="VueToNuxtLogo">
|
|
3
|
-
<div class="Triangle Triangle--two" />
|
|
4
|
-
<div class="Triangle Triangle--one" />
|
|
5
|
-
<div class="Triangle Triangle--three" />
|
|
6
|
-
<div class="Triangle Triangle--four" />
|
|
7
|
-
</div>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<style>
|
|
11
|
-
.VueToNuxtLogo {
|
|
12
|
-
display: inline-block;
|
|
13
|
-
animation: turn 2s linear forwards 1s;
|
|
14
|
-
transform: rotateX(180deg);
|
|
15
|
-
position: relative;
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
height: 180px;
|
|
18
|
-
width: 245px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.Triangle {
|
|
22
|
-
position: absolute;
|
|
23
|
-
top: 0;
|
|
24
|
-
left: 0;
|
|
25
|
-
width: 0;
|
|
26
|
-
height: 0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.Triangle--one {
|
|
30
|
-
border-left: 105px solid transparent;
|
|
31
|
-
border-right: 105px solid transparent;
|
|
32
|
-
border-bottom: 180px solid #41b883;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.Triangle--two {
|
|
36
|
-
top: 30px;
|
|
37
|
-
left: 35px;
|
|
38
|
-
animation: goright 0.5s linear forwards 3.5s;
|
|
39
|
-
border-left: 87.5px solid transparent;
|
|
40
|
-
border-right: 87.5px solid transparent;
|
|
41
|
-
border-bottom: 150px solid #3b8070;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.Triangle--three {
|
|
45
|
-
top: 60px;
|
|
46
|
-
left: 35px;
|
|
47
|
-
animation: goright 0.5s linear forwards 3.5s;
|
|
48
|
-
border-left: 70px solid transparent;
|
|
49
|
-
border-right: 70px solid transparent;
|
|
50
|
-
border-bottom: 120px solid #35495e;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.Triangle--four {
|
|
54
|
-
top: 120px;
|
|
55
|
-
left: 70px;
|
|
56
|
-
animation: godown 0.5s linear forwards 3s;
|
|
57
|
-
border-left: 35px solid transparent;
|
|
58
|
-
border-right: 35px solid transparent;
|
|
59
|
-
border-bottom: 60px solid #fff;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@keyframes turn {
|
|
63
|
-
100% {
|
|
64
|
-
transform: rotateX(0deg);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@keyframes godown {
|
|
69
|
-
100% {
|
|
70
|
-
top: 180px;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@keyframes goright {
|
|
75
|
-
100% {
|
|
76
|
-
left: 70px;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
</style>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-btn @click.native="logout" class="logout__btn">
|
|
3
|
-
<v-icon class="logout__icon">mdi-logout</v-icon>
|
|
4
|
-
<span class="logout__text">Logout</span>
|
|
5
|
-
</v-btn>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
export default {
|
|
10
|
-
name: "LogoutButton",
|
|
11
|
-
methods: {
|
|
12
|
-
logout() {
|
|
13
|
-
this.$store.dispatch("mapo/user/logout");
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<style lang="scss" scoped>
|
|
20
|
-
.logout {
|
|
21
|
-
&__btn {
|
|
22
|
-
padding: 0.5rem 1rem!important;
|
|
23
|
-
height: auto!important;
|
|
24
|
-
}
|
|
25
|
-
&__icon {
|
|
26
|
-
margin-right: 0.5rem;
|
|
27
|
-
font-size: 1rem;
|
|
28
|
-
}
|
|
29
|
-
&__text {
|
|
30
|
-
text-align: left;
|
|
31
|
-
display: block;
|
|
32
|
-
width: 100%;
|
|
33
|
-
font-size: 1rem;
|
|
34
|
-
text-transform: capitalize;
|
|
35
|
-
font-weight: 400;
|
|
36
|
-
letter-spacing: initial;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
</style>
|