@mapomodule/uikit 1.0.0-alpha.5 → 1.0.0-alpha.51
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/CHANGELOG.md +892 -0
- package/components/ConfirmDialog.vue +58 -37
- package/components/Detail/Detail.vue +450 -243
- package/components/Detail/DetailLangSwitch.vue +9 -2
- package/components/DropArea.vue +63 -56
- package/components/Form/Form.vue +218 -0
- package/components/Form/FormField.vue +214 -0
- package/components/Form/FormGroup.vue +146 -0
- package/components/Form/FormTabs.vue +188 -0
- package/components/Form/defaults.js +98 -0
- package/components/Form/fields/ColorField.vue +79 -0
- package/components/{fields → Form/fields}/DateField.vue +20 -11
- package/components/Form/fields/DateTimeField.vue +271 -0
- package/components/Form/fields/EnhancedMediaField.vue +224 -0
- package/components/Form/fields/FileField.vue +125 -0
- package/components/Form/fields/FksField.vue +88 -0
- package/components/Form/fields/MediaField.vue +159 -0
- package/components/Form/fields/MediaM2mField.vue +149 -0
- package/components/Form/fields/Repeater.vue +596 -0
- package/components/Form/fields/SeoPreview.vue +89 -0
- package/components/Form/fields/TimeField.vue +154 -0
- package/components/Form/fields/mapField/leaflet.injector.js +39 -0
- package/components/Form/fields/mapField/mapField.vue +348 -0
- package/components/Form/fields/wygEditor/defaults.js +25 -0
- package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/mapomedia.plugin.js +7 -6
- package/components/Form/fields/wygEditor/wygEditor.vue +285 -0
- package/components/Form/fields/wygEditorCKE/defaults.js +100 -0
- package/components/Form/fields/wygEditorCKE/utils/ckeditor.injector.js +29 -0
- package/components/Form/fields/wygEditorCKE/wygEditorCKE.vue +270 -0
- package/components/LangSwitcher.vue +44 -0
- package/components/List/List.vue +103 -51
- package/components/List/ListActions.vue +23 -5
- package/components/List/ListFilters.vue +166 -114
- package/components/List/ListHead.vue +30 -12
- package/components/List/ListQuickEdit.vue +130 -61
- package/components/List/ListTable.vue +210 -66
- package/components/Login.vue +17 -7
- package/components/LogoutButton.vue +43 -28
- package/components/MediaManager/MediaBreadcrumbs.vue +45 -0
- package/components/MediaManager/MediaEditor.vue +297 -120
- package/components/MediaManager/MediaFileChanger.vue +78 -0
- package/components/MediaManager/MediaFolders.vue +224 -116
- package/components/MediaManager/MediaGallery.vue +224 -145
- package/components/MediaManager/MediaManager.vue +125 -159
- package/components/MediaManager/MediaManagerDialog.vue +36 -31
- package/components/MediaManager/MediaPreview.vue +258 -0
- package/components/MediaManager/MediaUploader.vue +91 -90
- package/components/MenuManager/MenuManager.vue +332 -0
- package/components/MenuManager/MenuNodeEditor.vue +255 -0
- package/components/MenuManager/MenuTreeview.vue +237 -0
- package/components/MenuManager/MenuTreeviewNode.vue +208 -0
- package/components/PagePreview.vue +58 -0
- package/components/SnackBar.vue +5 -7
- package/components/ThemeToggle.vue +13 -0
- package/components/layout/Sidebar/Sidebar.vue +61 -30
- package/components/layout/Sidebar/SidebarList.vue +19 -15
- package/components/layout/Sidebar/SidebarListItem.vue +122 -38
- package/components/layout/Sidebar/SidebarProfile.vue +42 -0
- package/components/layout/Sidebar/SidebarTitle.vue +45 -0
- package/components/layout/Topbar/Topbar.vue +11 -42
- package/components/layout/routebuilder.js +3 -3
- package/defaults/i18n.js +37 -0
- package/defaults/vuetify.js +34 -0
- package/layouts/default.vue +33 -18
- package/layouts/empty.vue +10 -0
- package/module.js +7 -5
- package/package.json +6 -4
- package/pages/index.vue +19 -18
- package/static/mapo/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/dev/contents.css +35 -0
- package/static/mapo/ckeditor/plugins/image2/dev/image2.html +338 -0
- package/static/mapo/ckeditor/plugins/image2/dialogs/image2.js +557 -0
- package/static/mapo/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
- package/static/mapo/ckeditor/plugins/image2/icons/image.png +0 -0
- package/static/mapo/ckeditor/plugins/image2/lang/af.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ar.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/az.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/bg.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/bn.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/bs.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ca.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/cs.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/cy.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/da.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/de-ch.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/de.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/el.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/en-au.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/en-ca.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/en-gb.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/en.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/eo.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/es-mx.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/es.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/et.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/eu.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/fa.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/fi.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/fo.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/fr-ca.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/fr.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/gl.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/gu.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/he.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/hi.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/hr.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/hu.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/id.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/is.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/it.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ja.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ka.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/km.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ko.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ku.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/lt.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/lv.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/mk.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/mn.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ms.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/nb.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/nl.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/no.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/oc.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/pl.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/pt-br.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/pt.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ro.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ru.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/si.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sk.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sl.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sq.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sr-latn.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sr.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/sv.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/th.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/tr.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/tt.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/ug.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/uk.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/vi.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/zh-cn.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/lang/zh.js +21 -0
- package/static/mapo/ckeditor/plugins/image2/plugin.js +1798 -0
- package/static/mapo/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
- package/static/mapo/ckeditor/plugins/image2/samples/image2.html +68 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons16.png +0 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons16.svg +2374 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons32.png +0 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons32.svg +2722 -0
- package/static/mapo/ckeditor/skins/moono/dev/locations.json +144 -0
- package/static/mapo/ckeditor/skins/moono/dialog.css +5 -0
- package/static/mapo/ckeditor/skins/moono/dialog_ie.css +5 -0
- package/static/mapo/ckeditor/skins/moono/dialog_ie7.css +5 -0
- package/static/mapo/ckeditor/skins/moono/dialog_ie8.css +5 -0
- package/static/mapo/ckeditor/skins/moono/dialog_iequirks.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor_gecko.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor_ie.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor_ie7.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor_ie8.css +5 -0
- package/static/mapo/ckeditor/skins/moono/editor_iequirks.css +5 -0
- package/static/mapo/ckeditor/skins/moono/icons.png +0 -0
- package/static/mapo/ckeditor/skins/moono/icons_hidpi.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/anchor.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/arrow.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/anchor.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/hidpi/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono/images/spinner.gif +0 -0
- package/static/mapo/ckeditor/skins/moono/readme.md +49 -0
- package/static/mapo/ckeditor/skins/moono/skin.js +10 -0
- package/static/mapo/ckeditor/skins/moono-dark/dialog.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie7.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie8.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/dialog_iequirks.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor_gecko.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie7.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie8.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/editor_iequirks.css +5 -0
- package/static/mapo/ckeditor/skins/moono-dark/icons.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/icons_hidpi.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/arrow.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/close.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/hidpi/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/lock-open.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/lock.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/images/refresh.png +0 -0
- package/static/mapo/ckeditor/skins/moono-dark/readme.md +51 -0
- package/static/mapo/ckeditor/skins/moono-dark/skin.js +5 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
- package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
- package/translations/en-US.js +177 -0
- package/translations/it-IT.js +180 -0
- package/components/Detail/DetailField.vue +0 -129
- package/components/Detail/defaults.js +0 -50
- package/components/fields/M2mField.vue +0 -95
- package/components/fields/MediaField.vue +0 -195
- package/components/fields/MediaM2mField.vue +0 -238
- package/components/fields/TinyMce/TinyMce.vue +0 -177
- package/components/fields/TinyMce/defaults.js +0 -55
- package/components/layout/Sidebar/SidebarFooter.vue +0 -75
- package/defaults.js +0 -29
- package/layouts/error.vue +0 -45
- /package/components/{fields/TinyMce → Form/fields/wygEditor}/utils/events.js +0 -0
- /package/components/{fields/TinyMce/utils/script.injector.js → Form/fields/wygEditor/utils/tinymce.injector.js} +0 -0
- /package/static/{favicon.ico → mapo/favicon.ico} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-select
|
|
3
|
+
:items="$i18n.locales"
|
|
4
|
+
:value="$i18n.locale"
|
|
5
|
+
@input="$i18n.setLocale($event)"
|
|
6
|
+
dense
|
|
7
|
+
flat
|
|
8
|
+
hide-details
|
|
9
|
+
solo
|
|
10
|
+
background-color="transparent"
|
|
11
|
+
item-value="code"
|
|
12
|
+
>
|
|
13
|
+
<template v-slot:selection="{ item }">
|
|
14
|
+
{{ item.iso ? getFlag(item.iso) : item.name }}
|
|
15
|
+
</template>
|
|
16
|
+
<template v-slot:item="{ item, on, attrs }">
|
|
17
|
+
<v-list-item v-on="on" v-bind="attrs">
|
|
18
|
+
<v-list-item-icon class="mr-2">
|
|
19
|
+
{{ item.iso ? getFlag(item.iso) : item.name }}
|
|
20
|
+
</v-list-item-icon>
|
|
21
|
+
<v-list-item-title>
|
|
22
|
+
{{ item.name }}
|
|
23
|
+
</v-list-item-title>
|
|
24
|
+
</v-list-item>
|
|
25
|
+
</template>
|
|
26
|
+
</v-select>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
export default {
|
|
31
|
+
name: "LangSwitcher",
|
|
32
|
+
methods: {
|
|
33
|
+
getFlag(isoCode) {
|
|
34
|
+
const codePoints = isoCode
|
|
35
|
+
.split("-")
|
|
36
|
+
.slice(-1)[0]
|
|
37
|
+
.toUpperCase()
|
|
38
|
+
.split("")
|
|
39
|
+
.map((char) => 127397 + char.charCodeAt());
|
|
40
|
+
return String.fromCodePoint(...codePoints);
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
</script>
|
package/components/List/List.vue
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<ListHead v-bind="$attrs" />
|
|
4
4
|
|
|
5
5
|
<div>
|
|
6
|
-
<v-row class="mb-
|
|
6
|
+
<v-row class="mb-1">
|
|
7
7
|
<v-col cols="12" md="4">
|
|
8
8
|
<ListActions
|
|
9
9
|
v-bind="$attrs"
|
|
@@ -14,25 +14,7 @@
|
|
|
14
14
|
/>
|
|
15
15
|
</v-col>
|
|
16
16
|
<v-col cols="12" md="8" class="d-flex flex-nowrap justify-end align-center">
|
|
17
|
-
|
|
18
|
-
<slot name="item-counter" v-bind="{ selection, canSelectAll, allSelected, toggleSelectAll }">
|
|
19
|
-
<div class="caption mr-1">
|
|
20
|
-
<b v-if="allSelected">All items selected</b>
|
|
21
|
-
<span v-else-if="selection.length">
|
|
22
|
-
{{ selection.length }} items selected
|
|
23
|
-
<v-btn
|
|
24
|
-
v-if="selection != 'all' && canSelectAll"
|
|
25
|
-
@click="toggleSelectAll"
|
|
26
|
-
outlined
|
|
27
|
-
tile
|
|
28
|
-
x-small
|
|
29
|
-
class="ml-1 d-inline-flex"
|
|
30
|
-
>Select all</v-btn
|
|
31
|
-
>
|
|
32
|
-
</span>
|
|
33
|
-
</div>
|
|
34
|
-
</slot>
|
|
35
|
-
<ListFilters v-bind="$attrs" v-model="filters">
|
|
17
|
+
<ListFilters v-bind="$attrs" v-model="filters" :disabled="dragOrderingActive">
|
|
36
18
|
<template v-for="(_, slot) in $slots" :slot="slot">
|
|
37
19
|
<!-- @vuese-ignore -->
|
|
38
20
|
<slot :name="slot"></slot>
|
|
@@ -44,12 +26,33 @@
|
|
|
44
26
|
</ListFilters>
|
|
45
27
|
</v-col>
|
|
46
28
|
</v-row>
|
|
29
|
+
<div class="d-flex justify-end">
|
|
30
|
+
<!-- Overrides counter for selected items. -->
|
|
31
|
+
<slot name="item-counter" v-bind="{ selection, canSelectAll, allSelected, toggleSelectAll }">
|
|
32
|
+
<div v-if="selection" class="caption mr-1 mb-1">
|
|
33
|
+
<b v-if="allSelected">{{ $t("mapo.list.allSelected") }}</b>
|
|
34
|
+
<span v-else-if="selection.length">
|
|
35
|
+
{{ $t("mapo.list.NSelected", {numberItems: selection.length}) }}
|
|
36
|
+
<v-btn
|
|
37
|
+
v-if="selection != 'all' && canSelectAll"
|
|
38
|
+
@click="toggleSelectAll"
|
|
39
|
+
outlined
|
|
40
|
+
tile
|
|
41
|
+
x-small
|
|
42
|
+
class="ml-1 d-inline-flex"
|
|
43
|
+
>{{ $t("mapo.list.selectAll") }}</v-btn
|
|
44
|
+
>
|
|
45
|
+
</span>
|
|
46
|
+
</div>
|
|
47
|
+
</slot>
|
|
48
|
+
</div>
|
|
47
49
|
</div>
|
|
48
50
|
<div>
|
|
49
51
|
<ListTable
|
|
50
52
|
v-model="selection"
|
|
51
53
|
v-bind="{...$attrs, crud, filters}"
|
|
52
54
|
v-on="$listeners"
|
|
55
|
+
@drag-order-change="setDragOrdering"
|
|
53
56
|
ref="dtable"
|
|
54
57
|
>
|
|
55
58
|
<template v-for="(_, slot) in $slots" :slot="slot">
|
|
@@ -80,14 +83,15 @@ export default {
|
|
|
80
83
|
tabActiveStatus: 1,
|
|
81
84
|
selection: [],
|
|
82
85
|
allSelected: false,
|
|
83
|
-
filters: []
|
|
86
|
+
filters: [],
|
|
87
|
+
dragOrderingActive: false,
|
|
88
|
+
selectionQuery: null,
|
|
84
89
|
};
|
|
85
90
|
},
|
|
86
91
|
props: {
|
|
87
92
|
// The url of the endpoint that provides the data to display. From this url a complete crud (See [this.$mapo.$api.crud](/core/#$api.crud)) will be created.
|
|
88
93
|
endpoint: {
|
|
89
|
-
type: String
|
|
90
|
-
required: true,
|
|
94
|
+
type: String
|
|
91
95
|
},
|
|
92
96
|
// Add option to select all items in all pages
|
|
93
97
|
canSelectAll: Boolean,
|
|
@@ -96,17 +100,23 @@ export default {
|
|
|
96
100
|
crud() {
|
|
97
101
|
return this.$mapo.$api.crud(this.endpoint);
|
|
98
102
|
},
|
|
99
|
-
selectionQuery() {
|
|
100
|
-
return this.$refs?.dtable?.getHttpParams();
|
|
101
|
-
}
|
|
102
103
|
},
|
|
103
104
|
watch: {
|
|
104
105
|
selection(val) {
|
|
105
106
|
this.allSelected = val == 'all';
|
|
107
|
+
this.selectionQuery = this.$refs.dtable.getHttpParams();
|
|
106
108
|
// Fires when you select some row of the table.
|
|
107
109
|
// @arg Emit "all" if all items are selected, else the list of the selected rows.
|
|
108
110
|
this.$emit("selectionChange", val);
|
|
109
111
|
},
|
|
112
|
+
filters: {
|
|
113
|
+
deep: true,
|
|
114
|
+
handler(val) {
|
|
115
|
+
// Fires when you change filters options.
|
|
116
|
+
// @arg Emits the same array prop `filters` passed to the component and every filter object inside it contains an `active` array that contains the selected options.
|
|
117
|
+
this.$emit("filtersChange", val);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
110
120
|
},
|
|
111
121
|
methods: {
|
|
112
122
|
refresh() {
|
|
@@ -114,6 +124,12 @@ export default {
|
|
|
114
124
|
},
|
|
115
125
|
toggleSelectAll() {
|
|
116
126
|
return this.$refs?.dtable?.toggleSelectAll();
|
|
127
|
+
},
|
|
128
|
+
setDragOrdering(val){
|
|
129
|
+
this.dragOrderingActive = val;
|
|
130
|
+
if(val){
|
|
131
|
+
this.filters = [];
|
|
132
|
+
}
|
|
117
133
|
}
|
|
118
134
|
},
|
|
119
135
|
mounted() {},
|
|
@@ -156,20 +172,27 @@ This is an interactive example. You can play with it but remember that all http
|
|
|
156
172
|
|
|
157
173
|
::: demo
|
|
158
174
|
<template>
|
|
159
|
-
<v-app
|
|
160
|
-
|
|
175
|
+
<v-app>
|
|
176
|
+
<div class="d-flex justify-end"><ThemeToggle/></div>
|
|
177
|
+
<List
|
|
161
178
|
show-select
|
|
179
|
+
title="Sweets archive:"
|
|
180
|
+
lookup="name"
|
|
162
181
|
:headers="headers"
|
|
163
182
|
:editFields="editFields"
|
|
164
183
|
:filters="availableFilters"
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
addItem
|
|
168
|
-
canSelectAll
|
|
184
|
+
multi-sort
|
|
185
|
+
can-select-all
|
|
169
186
|
searchable
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
187
|
+
:data.sync="desserts"
|
|
188
|
+
:actions="[]"
|
|
189
|
+
drag-reorder
|
|
190
|
+
>
|
|
191
|
+
</List>
|
|
192
|
+
<br>
|
|
193
|
+
<h3> Data: </h3>
|
|
194
|
+
<pre style="background-color: unset">{{ desserts }}</pre>
|
|
195
|
+
</v-app>
|
|
173
196
|
</template>
|
|
174
197
|
|
|
175
198
|
<script>
|
|
@@ -178,37 +201,66 @@ export default {
|
|
|
178
201
|
return {
|
|
179
202
|
headers: [
|
|
180
203
|
{
|
|
181
|
-
text: "
|
|
204
|
+
text: "Dessert (100g serving)",
|
|
182
205
|
align: "start",
|
|
183
206
|
sortable: false,
|
|
184
|
-
value: "
|
|
207
|
+
value: "name",
|
|
185
208
|
},
|
|
186
|
-
{ text: "
|
|
187
|
-
{ text: "
|
|
209
|
+
{ text: "Protein (g)", value: "protein" },
|
|
210
|
+
{ text: "Gluten-Free", value: "glutenfree" },
|
|
188
211
|
{ text: "Actions", value: "actions", sortable: false },
|
|
189
212
|
],
|
|
190
213
|
editFields: [
|
|
191
|
-
{ attrs: { rules:[v => !!v ||
|
|
192
|
-
{
|
|
193
|
-
{ attrs: { rules:[v => !!v || 'Identifier is required'] }, value: "identifier" },
|
|
214
|
+
{ attrs: { rules: [(v) => !!v || "Name is required"] }, value: "name" },
|
|
215
|
+
{ value: "protein" }
|
|
194
216
|
],
|
|
195
217
|
availableFilters: [
|
|
196
218
|
{
|
|
197
|
-
text: "
|
|
198
|
-
value: "
|
|
219
|
+
text: "Gluten Free",
|
|
220
|
+
value: "glutenfree",
|
|
199
221
|
choices: [
|
|
200
|
-
{ text: "
|
|
201
|
-
{ text: "
|
|
202
|
-
{ text: "Trash", value: "TRS" },
|
|
222
|
+
{ text: "Yes", value: true },
|
|
223
|
+
{ text: "No", value: false },
|
|
203
224
|
],
|
|
204
225
|
},
|
|
226
|
+
],
|
|
227
|
+
desserts: [
|
|
205
228
|
{
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
229
|
+
name: "Frozen Yogurt",
|
|
230
|
+
protein: 4.0,
|
|
231
|
+
glutenfree: true,
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: "Ice cream sandwich",
|
|
235
|
+
protein: 4.3,
|
|
236
|
+
glutenfree: false,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: "Eclair",
|
|
240
|
+
protein: 6.0,
|
|
241
|
+
glutenfree: false,
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: "Jelly bean",
|
|
245
|
+
protein: 0.0,
|
|
246
|
+
glutenfree: true,
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: "Lollipop",
|
|
250
|
+
protein: 0,
|
|
251
|
+
glutenfree: true,
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: "KitKat",
|
|
255
|
+
protein: 7,
|
|
256
|
+
glutenfree: false,
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
name: "KitKat2",
|
|
260
|
+
protein: 77,
|
|
261
|
+
glutenfree: false,
|
|
209
262
|
},
|
|
210
263
|
],
|
|
211
|
-
|
|
212
264
|
};
|
|
213
265
|
},
|
|
214
266
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="isActive" class="d-flex flex-row align-center fill-height">
|
|
3
3
|
<v-select
|
|
4
|
-
label="
|
|
4
|
+
:label="$t('mapo.listActions.groupActions')"
|
|
5
5
|
v-bind="$attrs"
|
|
6
6
|
v-model="action"
|
|
7
7
|
:items="filteredActions"
|
|
8
|
+
:item-disabled="isDisabled"
|
|
8
9
|
item-text="label"
|
|
9
10
|
item-value="handler"
|
|
10
11
|
outlined
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
hide-details
|
|
13
14
|
clearable
|
|
14
15
|
no-data-text="No actions available"
|
|
16
|
+
class="rounded-0"
|
|
15
17
|
></v-select>
|
|
16
18
|
<v-btn
|
|
17
19
|
class="rounded-0 elevation-0 ml-2"
|
|
@@ -19,7 +21,7 @@
|
|
|
19
21
|
color="primary"
|
|
20
22
|
:disabled="!action"
|
|
21
23
|
@click="handleAction"
|
|
22
|
-
>
|
|
24
|
+
>{{ $t("mapo.apply") }}</v-btn
|
|
23
25
|
>
|
|
24
26
|
</div>
|
|
25
27
|
</template>
|
|
@@ -49,10 +51,11 @@ export default {
|
|
|
49
51
|
default() {
|
|
50
52
|
return [
|
|
51
53
|
{
|
|
52
|
-
label: "
|
|
54
|
+
label: this.$t("mapo.listActions.permanentDelete"),
|
|
53
55
|
handler: function ({ selection, lookup, crud }) {
|
|
54
|
-
return Promise.all(selection.map((i) => crud.delete(i[lookup])));
|
|
56
|
+
return Promise.all(selection.map((i) => crud && crud.delete(i[lookup])));
|
|
55
57
|
},
|
|
58
|
+
permissions: "delete"
|
|
56
59
|
},
|
|
57
60
|
];
|
|
58
61
|
},
|
|
@@ -89,10 +92,23 @@ export default {
|
|
|
89
92
|
}
|
|
90
93
|
},
|
|
91
94
|
methods: {
|
|
95
|
+
isDisabled(action){
|
|
96
|
+
const p = typeof action.permissions == "string" ? [action.permissions] : action.permissions || []
|
|
97
|
+
if (p.length){
|
|
98
|
+
return !p.every(a => this.userCan(a))
|
|
99
|
+
}
|
|
100
|
+
return false
|
|
101
|
+
},
|
|
102
|
+
userCan(action) {
|
|
103
|
+
if (this.$mapo.$auth.routeMiddlewares.includes("permissions")){
|
|
104
|
+
return this.$mapo.$auth.user.permissions.includes(action)
|
|
105
|
+
}
|
|
106
|
+
return true
|
|
107
|
+
},
|
|
92
108
|
handleAction() {
|
|
93
109
|
if (!this.selectAll && !this.selection.length) {
|
|
94
110
|
return this.$mapo.$snack.open({
|
|
95
|
-
message: "
|
|
111
|
+
message: this.$t("mapo.listActions.selectionRequired"),
|
|
96
112
|
color: "error",
|
|
97
113
|
});
|
|
98
114
|
}
|
|
@@ -120,6 +136,7 @@ The actions prop is a list of `Action` objects containing these keys:
|
|
|
120
136
|
- **"handleMultiple"** `Boolean` ==> Make the action callable on multiple items. Default: `true`.
|
|
121
137
|
- **"handleAll"** `Boolean` ==> Make the action callable on all items. Default: `false`.
|
|
122
138
|
- **"handler"** `Function` ==> The callback function that will be executed once the user confirms the action.
|
|
139
|
+
- **"permissions"** `String | Array` ==> The list of permissions needed by the user to perform action in a page with permission middleware
|
|
123
140
|
|
|
124
141
|
The handler function will be called with a ctx containing:
|
|
125
142
|
- **"selection"** `Array<Object>` or `String` ==> `"all"` if all items are selected else the list of selected objects.
|
|
@@ -140,6 +157,7 @@ const actions = [
|
|
|
140
157
|
selection.map((i) => crud.delete(i[lookup]))
|
|
141
158
|
);
|
|
142
159
|
},
|
|
160
|
+
permissions: "delete"
|
|
143
161
|
}
|
|
144
162
|
]
|
|
145
163
|
```
|