@mapomodule/uikit 1.0.0 → 2.0.0-beta.10
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 +199 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/module.d.mts +60 -0
- package/dist/module.d.ts +55 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +179 -0
- package/dist/runtime/adapters/defaultMediaAdapter.d.ts +14 -0
- package/dist/runtime/adapters/defaultMediaAdapter.d.ts.map +1 -0
- package/dist/runtime/adapters/defaultMediaAdapter.js +30 -0
- package/dist/runtime/assets/main.css +1 -0
- package/dist/runtime/components/MapoConfirmDialog.vue +35 -0
- package/dist/runtime/components/MapoConfirmDialog.vue.d.ts +4 -0
- package/dist/runtime/components/MapoConfirmDialog.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoDetail.vue +606 -0
- package/dist/runtime/components/MapoDetail.vue.d.ts +401 -0
- package/dist/runtime/components/MapoDetail.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoDetailLangSwitch.vue +126 -0
- package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts +23 -0
- package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoDropArea.vue +99 -0
- package/dist/runtime/components/MapoDropArea.vue.d.ts +33 -0
- package/dist/runtime/components/MapoDropArea.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoLangSwitcher.vue +39 -0
- package/dist/runtime/components/MapoLangSwitcher.vue.d.ts +18 -0
- package/dist/runtime/components/MapoLangSwitcher.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoList.vue +191 -0
- package/dist/runtime/components/MapoList.vue.d.ts +111 -0
- package/dist/runtime/components/MapoList.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListActions.vue +119 -0
- package/dist/runtime/components/MapoListActions.vue.d.ts +33 -0
- package/dist/runtime/components/MapoListActions.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListFilters.vue +246 -0
- package/dist/runtime/components/MapoListFilters.vue.d.ts +38 -0
- package/dist/runtime/components/MapoListFilters.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListHead.vue +9 -0
- package/dist/runtime/components/MapoListHead.vue.d.ts +14 -0
- package/dist/runtime/components/MapoListHead.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListQuickEdit.vue +123 -0
- package/dist/runtime/components/MapoListQuickEdit.vue.d.ts +47 -0
- package/dist/runtime/components/MapoListQuickEdit.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListTable.vue +665 -0
- package/dist/runtime/components/MapoListTable.vue.d.ts +105 -0
- package/dist/runtime/components/MapoListTable.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListTabs.vue +38 -0
- package/dist/runtime/components/MapoListTabs.vue.d.ts +26 -0
- package/dist/runtime/components/MapoListTabs.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoLogin.vue +196 -0
- package/dist/runtime/components/MapoLogin.vue.d.ts +22 -0
- package/dist/runtime/components/MapoLogin.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoLogoutButton.vue +27 -0
- package/dist/runtime/components/MapoLogoutButton.vue.d.ts +29 -0
- package/dist/runtime/components/MapoLogoutButton.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue +47 -0
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts +4 -0
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaEditor.vue +320 -0
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts +8 -0
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue +112 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts +15 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaFolders.vue +220 -0
- package/dist/runtime/components/MapoMediaFolders.vue.d.ts +4 -0
- package/dist/runtime/components/MapoMediaFolders.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaGallery.vue +219 -0
- package/dist/runtime/components/MapoMediaGallery.vue.d.ts +4 -0
- package/dist/runtime/components/MapoMediaGallery.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaManager.vue +140 -0
- package/dist/runtime/components/MapoMediaManager.vue.d.ts +35 -0
- package/dist/runtime/components/MapoMediaManager.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue +116 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts +41 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaPreview.vue +92 -0
- package/dist/runtime/components/MapoMediaPreview.vue.d.ts +19 -0
- package/dist/runtime/components/MapoMediaPreview.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaUploader.vue +290 -0
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts +8 -0
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuManager.vue +273 -0
- package/dist/runtime/components/MapoMenuManager.vue.d.ts +92 -0
- package/dist/runtime/components/MapoMenuManager.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue +201 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts +61 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuTreeview.vue +181 -0
- package/dist/runtime/components/MapoMenuTreeview.vue.d.ts +57 -0
- package/dist/runtime/components/MapoMenuTreeview.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue +175 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts +27 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoRootComponents.vue +9 -0
- package/dist/runtime/components/MapoRootComponents.vue.d.ts +4 -0
- package/dist/runtime/components/MapoRootComponents.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebar.vue +89 -0
- package/dist/runtime/components/MapoSidebar.vue.d.ts +22 -0
- package/dist/runtime/components/MapoSidebar.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebarList.vue +27 -0
- package/dist/runtime/components/MapoSidebarList.vue.d.ts +8 -0
- package/dist/runtime/components/MapoSidebarList.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebarListItem.vue +74 -0
- package/dist/runtime/components/MapoSidebarListItem.vue.d.ts +9 -0
- package/dist/runtime/components/MapoSidebarListItem.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebarProfile.vue +55 -0
- package/dist/runtime/components/MapoSidebarProfile.vue.d.ts +10 -0
- package/dist/runtime/components/MapoSidebarProfile.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSnackBar.vue +38 -0
- package/dist/runtime/components/MapoSnackBar.vue.d.ts +4 -0
- package/dist/runtime/components/MapoSnackBar.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoThemeToggle.vue +23 -0
- package/dist/runtime/components/MapoThemeToggle.vue.d.ts +4 -0
- package/dist/runtime/components/MapoThemeToggle.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoTopbar.vue +30 -0
- package/dist/runtime/components/MapoTopbar.vue.d.ts +15 -0
- package/dist/runtime/components/MapoTopbar.vue.d.ts.map +1 -0
- package/dist/runtime/components/menuDndContext.d.ts +19 -0
- package/dist/runtime/components/menuDndContext.d.ts.map +1 -0
- package/dist/runtime/components/menuDndContext.js +3 -0
- package/dist/runtime/layouts/default.vue +43 -0
- package/dist/runtime/layouts/default.vue.d.ts +20 -0
- package/dist/runtime/layouts/default.vue.d.ts.map +1 -0
- package/dist/runtime/layouts/empty.vue +9 -0
- package/dist/runtime/layouts/empty.vue.d.ts +14 -0
- package/dist/runtime/layouts/empty.vue.d.ts.map +1 -0
- package/dist/runtime/page-meta.nuxt.d.ts +45 -0
- package/dist/runtime/pages/index.vue +14 -0
- package/dist/runtime/pages/index.vue.d.ts +4 -0
- package/dist/runtime/pages/index.vue.d.ts.map +1 -0
- package/dist/runtime/pages/login.vue +3 -0
- package/dist/runtime/pages/login.vue.d.ts +4 -0
- package/dist/runtime/pages/login.vue.d.ts.map +1 -0
- package/dist/runtime/plugins/media-adapter.d.ts +18 -0
- package/dist/runtime/plugins/media-adapter.d.ts.map +1 -0
- package/dist/runtime/plugins/media-adapter.js +8 -0
- package/dist/runtime/stores/media.d.ts +462 -0
- package/dist/runtime/stores/media.d.ts.map +1 -0
- package/dist/runtime/stores/media.js +344 -0
- package/dist/runtime/types/list.d.ts +59 -0
- package/dist/runtime/types/list.d.ts.map +1 -0
- package/dist/runtime/types/list.js +0 -0
- package/dist/runtime/types/media.d.ts +116 -0
- package/dist/runtime/types/media.d.ts.map +1 -0
- package/dist/runtime/types/media.js +0 -0
- package/dist/runtime/types/menu.d.ts +66 -0
- package/dist/runtime/types/menu.d.ts.map +1 -0
- package/dist/runtime/types/menu.js +30 -0
- package/dist/types.d.mts +9 -0
- package/package.json +67 -12
- package/src/index.ts +30 -0
- package/src/module.ts +311 -0
- package/src/runtime/adapters/defaultMediaAdapter.ts +57 -0
- package/src/runtime/assets/main.css +59 -0
- package/src/runtime/components/MapoConfirmDialog.vue +36 -0
- package/src/runtime/components/MapoDetail.vue +864 -0
- package/src/runtime/components/MapoDetailLangSwitch.vue +166 -0
- package/src/runtime/components/MapoDropArea.vue +127 -0
- package/src/runtime/components/MapoLangSwitcher.vue +74 -0
- package/src/runtime/components/MapoList.vue +339 -0
- package/src/runtime/components/MapoListActions.vue +158 -0
- package/src/runtime/components/MapoListFilters.vue +292 -0
- package/src/runtime/components/MapoListHead.vue +12 -0
- package/src/runtime/components/MapoListQuickEdit.vue +166 -0
- package/src/runtime/components/MapoListTable.vue +931 -0
- package/src/runtime/components/MapoListTabs.vue +48 -0
- package/src/runtime/components/MapoLogin.vue +212 -0
- package/src/runtime/components/MapoLogoutButton.vue +48 -0
- package/src/runtime/components/MapoMediaBreadcrumbs.vue +53 -0
- package/src/runtime/components/MapoMediaEditor.vue +350 -0
- package/src/runtime/components/MapoMediaFileChanger.vue +136 -0
- package/src/runtime/components/MapoMediaFolders.vue +239 -0
- package/src/runtime/components/MapoMediaGallery.vue +239 -0
- package/src/runtime/components/MapoMediaManager.vue +180 -0
- package/src/runtime/components/MapoMediaManagerDialog.vue +148 -0
- package/src/runtime/components/MapoMediaPreview.vue +111 -0
- package/src/runtime/components/MapoMediaUploader.vue +351 -0
- package/src/runtime/components/MapoMenuManager.vue +402 -0
- package/src/runtime/components/MapoMenuNodeEditor.vue +282 -0
- package/src/runtime/components/MapoMenuTreeview.vue +264 -0
- package/src/runtime/components/MapoMenuTreeviewNode.vue +234 -0
- package/src/runtime/components/MapoRootComponents.vue +9 -0
- package/src/runtime/components/MapoSidebar.vue +114 -0
- package/src/runtime/components/MapoSidebarList.vue +35 -0
- package/src/runtime/components/MapoSidebarListItem.vue +79 -0
- package/src/runtime/components/MapoSidebarProfile.vue +61 -0
- package/src/runtime/components/MapoSnackBar.vue +42 -0
- package/src/runtime/components/MapoThemeToggle.vue +27 -0
- package/src/runtime/components/MapoTopbar.vue +36 -0
- package/src/runtime/components/menuDndContext.ts +22 -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 +15 -0
- package/src/runtime/pages/login.vue +3 -0
- package/src/runtime/plugins/media-adapter.ts +33 -0
- package/src/runtime/stores/media.ts +474 -0
- package/src/runtime/types/list.ts +64 -0
- package/src/runtime/types/media.ts +126 -0
- package/src/runtime/types/menu.ts +105 -0
- package/CHANGELOG.md +0 -1030
- package/assets/mixins.scss +0 -22
- package/assets/variables.scss +0 -18
- package/components/ConfirmDialog.vue +0 -173
- package/components/Detail/Detail.vue +0 -696
- package/components/Detail/DetailLangSwitch.vue +0 -79
- package/components/DropArea.vue +0 -257
- package/components/Form/Form.vue +0 -218
- package/components/Form/FormField.vue +0 -216
- package/components/Form/FormGroup.vue +0 -146
- package/components/Form/FormTabs.vue +0 -188
- package/components/Form/defaults.js +0 -98
- package/components/Form/fields/ColorField.vue +0 -79
- package/components/Form/fields/DateField.vue +0 -77
- package/components/Form/fields/DateTimeField.vue +0 -271
- package/components/Form/fields/EnhancedMediaField.vue +0 -224
- package/components/Form/fields/FileField.vue +0 -125
- package/components/Form/fields/FksField.vue +0 -115
- package/components/Form/fields/MediaField.vue +0 -159
- package/components/Form/fields/MediaM2mField.vue +0 -149
- package/components/Form/fields/Repeater.vue +0 -618
- package/components/Form/fields/SeoPreview.vue +0 -89
- package/components/Form/fields/TimeField.vue +0 -154
- package/components/Form/fields/mapField/leaflet.injector.js +0 -39
- package/components/Form/fields/mapField/mapField.vue +0 -350
- package/components/Form/fields/wygEditor/defaults.js +0 -25
- package/components/Form/fields/wygEditor/utils/events.js +0 -64
- package/components/Form/fields/wygEditor/utils/mapomedia.plugin.js +0 -32
- package/components/Form/fields/wygEditor/utils/tinymce.injector.js +0 -29
- package/components/Form/fields/wygEditor/wygEditor.vue +0 -285
- package/components/Form/fields/wygEditorCKE/defaults.js +0 -103
- package/components/Form/fields/wygEditorCKE/utils/ckeditor.injector.js +0 -29
- package/components/Form/fields/wygEditorCKE/wygEditorCKE.vue +0 -270
- package/components/LangSwitcher.vue +0 -44
- package/components/List/List.vue +0 -271
- package/components/List/ListActions.vue +0 -164
- package/components/List/ListFilters.vue +0 -372
- package/components/List/ListHead.vue +0 -67
- package/components/List/ListQuickEdit.vue +0 -228
- package/components/List/ListTable.vue +0 -484
- package/components/List/ListTabs.vue +0 -65
- package/components/Login.vue +0 -125
- package/components/Logo.vue +0 -79
- package/components/LogoutButton.vue +0 -54
- package/components/MediaManager/MediaBreadcrumbs.vue +0 -45
- package/components/MediaManager/MediaEditor.vue +0 -340
- package/components/MediaManager/MediaFileChanger.vue +0 -78
- package/components/MediaManager/MediaFolders.vue +0 -287
- package/components/MediaManager/MediaGallery.vue +0 -281
- package/components/MediaManager/MediaManager.vue +0 -159
- package/components/MediaManager/MediaManagerDialog.vue +0 -104
- package/components/MediaManager/MediaPreview.vue +0 -258
- package/components/MediaManager/MediaUploader.vue +0 -163
- package/components/MenuManager/MenuManager.vue +0 -332
- package/components/MenuManager/MenuNodeEditor.vue +0 -270
- package/components/MenuManager/MenuTreeview.vue +0 -237
- package/components/MenuManager/MenuTreeviewNode.vue +0 -208
- package/components/PagePreview.vue +0 -58
- package/components/RootComponents.vue +0 -25
- package/components/SnackBar.vue +0 -69
- package/components/ThemeToggle.vue +0 -13
- package/components/layout/Sidebar/Sidebar.vue +0 -89
- package/components/layout/Sidebar/SidebarList.vue +0 -49
- package/components/layout/Sidebar/SidebarListItem.vue +0 -185
- package/components/layout/Sidebar/SidebarProfile.vue +0 -42
- package/components/layout/Sidebar/SidebarTitle.vue +0 -45
- package/components/layout/Topbar/Topbar.vue +0 -29
- package/components/layout/routebuilder.js +0 -48
- package/defaults/i18n.js +0 -37
- package/defaults/vuetify.js +0 -34
- package/layouts/default.vue +0 -47
- package/layouts/empty.vue +0 -16
- package/module.js +0 -80
- package/pages/index.vue +0 -37
- package/pages/login.vue +0 -10
- 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 +0 -35
- package/static/mapo/ckeditor/plugins/image2/dev/image2.html +0 -338
- package/static/mapo/ckeditor/plugins/image2/dialogs/image2.js +0 -557
- 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 +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ar.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/az.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/bg.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/bn.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/bs.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ca.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/cs.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/cy.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/da.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/de-ch.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/de.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/el.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/en-au.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/en-ca.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/en-gb.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/en.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/eo.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/es-mx.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/es.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/et.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/eu.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/fa.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/fi.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/fo.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/fr-ca.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/fr.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/gl.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/gu.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/he.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/hi.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/hr.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/hu.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/id.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/is.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/it.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ja.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ka.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/km.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ko.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ku.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/lt.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/lv.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/mk.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/mn.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ms.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/nb.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/nl.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/no.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/oc.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/pl.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/pt-br.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/pt.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ro.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ru.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/si.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sk.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sl.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sq.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sr-latn.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sr.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/sv.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/th.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/tr.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/tt.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/ug.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/uk.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/vi.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/zh-cn.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/lang/zh.js +0 -21
- package/static/mapo/ckeditor/plugins/image2/plugin.js +0 -1798
- 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 +0 -68
- package/static/mapo/ckeditor/skins/moono/dev/icons16.png +0 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons16.svg +0 -2374
- package/static/mapo/ckeditor/skins/moono/dev/icons32.png +0 -0
- package/static/mapo/ckeditor/skins/moono/dev/icons32.svg +0 -2722
- package/static/mapo/ckeditor/skins/moono/dev/locations.json +0 -144
- package/static/mapo/ckeditor/skins/moono/dialog.css +0 -5
- package/static/mapo/ckeditor/skins/moono/dialog_ie.css +0 -5
- package/static/mapo/ckeditor/skins/moono/dialog_ie7.css +0 -5
- package/static/mapo/ckeditor/skins/moono/dialog_ie8.css +0 -5
- package/static/mapo/ckeditor/skins/moono/dialog_iequirks.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor_gecko.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor_ie.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor_ie7.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor_ie8.css +0 -5
- package/static/mapo/ckeditor/skins/moono/editor_iequirks.css +0 -5
- 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 +0 -49
- package/static/mapo/ckeditor/skins/moono/skin.js +0 -10
- package/static/mapo/ckeditor/skins/moono-dark/dialog.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie7.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/dialog_ie8.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/dialog_iequirks.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor_gecko.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie7.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor_ie8.css +0 -5
- package/static/mapo/ckeditor/skins/moono-dark/editor_iequirks.css +0 -5
- 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 +0 -51
- package/static/mapo/ckeditor/skins/moono-dark/skin.js +0 -5
- package/static/mapo/favicon.ico +0 -0
- package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-dark/content.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-light/content.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-light/skin.min.css +0 -7
- package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +0 -7
- package/translations/en-US.js +0 -177
- package/translations/it-IT.js +0 -180
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import {
|
|
3
|
+
ref,
|
|
4
|
+
shallowRef,
|
|
5
|
+
computed,
|
|
6
|
+
watch,
|
|
7
|
+
h,
|
|
8
|
+
resolveComponent,
|
|
9
|
+
useSlots
|
|
10
|
+
} from "vue";
|
|
11
|
+
import { useI18n } from "vue-i18n";
|
|
12
|
+
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
13
|
+
import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
|
|
14
|
+
import { usePermissions } from "@mapomodule/store/runtime/composables/usePermissions";
|
|
15
|
+
import { useCrud } from "@mapomodule/core/runtime/api/crud";
|
|
16
|
+
import { debounce, splitEndpointParams } from "@mapomodule/utils";
|
|
17
|
+
import { useRoute, useRouter } from "#app";
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
endpoint: { type: String, required: false, default: "" },
|
|
20
|
+
items: { type: Array, required: false, default: void 0 },
|
|
21
|
+
crudEndpoint: { type: String, required: false },
|
|
22
|
+
filterParams: { type: Object, required: false },
|
|
23
|
+
defaultPageSize: { type: Number, required: false, default: 20 },
|
|
24
|
+
pageSizeOptions: { type: Array, required: false, default: () => [10, 20, 50, 100] },
|
|
25
|
+
responseAdapter: { type: Function, required: false },
|
|
26
|
+
paginationParams: { type: Function, required: false },
|
|
27
|
+
clientSide: { type: Boolean, required: false, default: false },
|
|
28
|
+
columns: { type: Array, required: true },
|
|
29
|
+
lookup: { type: String, required: false, default: "id" },
|
|
30
|
+
searchable: { type: Boolean, required: false, default: true },
|
|
31
|
+
draggable: { type: Boolean, required: false, default: false },
|
|
32
|
+
positionField: { type: String, required: false, default: "position" },
|
|
33
|
+
editFields: { type: Array, required: false, default: () => [] },
|
|
34
|
+
languages: { type: Array, required: false },
|
|
35
|
+
registry: { type: Object, required: false },
|
|
36
|
+
detailBase: { type: String, required: false },
|
|
37
|
+
permissionModel: { type: String, required: false }
|
|
38
|
+
});
|
|
39
|
+
const offlineMode = computed(() => Array.isArray(props.items));
|
|
40
|
+
const hybridMode = computed(() => !offlineMode.value && props.clientSide);
|
|
41
|
+
const emit = defineEmits(["update:selection", "update:selectionQuery", "update:items"]);
|
|
42
|
+
defineExpose({ refresh });
|
|
43
|
+
defineSlots();
|
|
44
|
+
const slots = useSlots();
|
|
45
|
+
const atKey = (item, key) => item[key];
|
|
46
|
+
const { t } = useI18n();
|
|
47
|
+
const snack = useSnackStore();
|
|
48
|
+
const confirm = useConfirmStore();
|
|
49
|
+
const route = useRoute();
|
|
50
|
+
const router = useRouter();
|
|
51
|
+
const crudBase = props.crudEndpoint ?? (splitEndpointParams(props.endpoint).path || props.endpoint);
|
|
52
|
+
const crud = useCrud(crudBase);
|
|
53
|
+
const { canChange, canDelete: canDeletePerm } = usePermissions();
|
|
54
|
+
const canEditRow = computed(
|
|
55
|
+
() => !props.permissionModel || canChange(props.permissionModel)
|
|
56
|
+
);
|
|
57
|
+
const canDeleteRow = computed(
|
|
58
|
+
() => !props.permissionModel || canDeletePerm(props.permissionModel)
|
|
59
|
+
);
|
|
60
|
+
const rows = shallowRef([]);
|
|
61
|
+
const fullDataset = shallowRef([]);
|
|
62
|
+
const hybridLoaded = ref(false);
|
|
63
|
+
const total = ref(0);
|
|
64
|
+
const loading = ref(false);
|
|
65
|
+
function toPositiveNumber(value, fallback) {
|
|
66
|
+
const n = Number(value);
|
|
67
|
+
return Number.isFinite(n) && n > 0 ? n : fallback;
|
|
68
|
+
}
|
|
69
|
+
const pagination = ref({
|
|
70
|
+
pageIndex: route.query.page ? Math.max(0, toPositiveNumber(route.query.page, 1) - 1) : 0,
|
|
71
|
+
pageSize: route.query.page_size ? toPositiveNumber(route.query.page_size, props.defaultPageSize) : props.defaultPageSize
|
|
72
|
+
});
|
|
73
|
+
const sorting = ref(
|
|
74
|
+
route.query.ordering ? String(route.query.ordering).split(",").map((o) => ({
|
|
75
|
+
id: o.startsWith("-") ? o.slice(1) : o,
|
|
76
|
+
desc: o.startsWith("-")
|
|
77
|
+
})) : []
|
|
78
|
+
);
|
|
79
|
+
const search = ref(route.query.search ? String(route.query.search) : "");
|
|
80
|
+
const onSearchInput = debounce((val) => {
|
|
81
|
+
search.value = String(val ?? "");
|
|
82
|
+
pagination.value = { ...pagination.value, pageIndex: 0 };
|
|
83
|
+
}, 350);
|
|
84
|
+
const writeUrlState = debounce(() => {
|
|
85
|
+
const query = {
|
|
86
|
+
...route.query
|
|
87
|
+
};
|
|
88
|
+
const page = pagination.value.pageIndex + 1;
|
|
89
|
+
if (page > 1) query.page = String(page);
|
|
90
|
+
else delete query.page;
|
|
91
|
+
if (pagination.value.pageSize !== props.defaultPageSize)
|
|
92
|
+
query.page_size = String(pagination.value.pageSize);
|
|
93
|
+
else delete query.page_size;
|
|
94
|
+
if (search.value) query.search = search.value;
|
|
95
|
+
else delete query.search;
|
|
96
|
+
if (sorting.value.length)
|
|
97
|
+
query.ordering = sorting.value.map((s) => `${s.desc ? "-" : ""}${s.id}`).join(",");
|
|
98
|
+
else delete query.ordering;
|
|
99
|
+
router.replace({ query });
|
|
100
|
+
}, 150);
|
|
101
|
+
watch([pagination, search, sorting], writeUrlState, { deep: true });
|
|
102
|
+
const rowSelection = ref({});
|
|
103
|
+
const pkOf = (row) => String(atKey(row, props.lookup));
|
|
104
|
+
const isAllSelected = computed(
|
|
105
|
+
() => rows.value.length > 0 && rows.value.every((r) => rowSelection.value[pkOf(r)])
|
|
106
|
+
);
|
|
107
|
+
const isIndeterminate = computed(() => {
|
|
108
|
+
const some = rows.value.some((r) => rowSelection.value[pkOf(r)]);
|
|
109
|
+
return some && !isAllSelected.value;
|
|
110
|
+
});
|
|
111
|
+
const selectedRows = computed(
|
|
112
|
+
() => rows.value.filter((r) => rowSelection.value[pkOf(r)])
|
|
113
|
+
);
|
|
114
|
+
watch(selectedRows, (rows2) => {
|
|
115
|
+
emit("update:selection", rows2);
|
|
116
|
+
emit("update:selectionQuery", buildSelectionQuery());
|
|
117
|
+
});
|
|
118
|
+
function buildSelectionQuery() {
|
|
119
|
+
const params = new URLSearchParams();
|
|
120
|
+
params.set("page_size", String(pagination.value.pageSize));
|
|
121
|
+
if (search.value) params.set("search", search.value);
|
|
122
|
+
sorting.value.forEach(
|
|
123
|
+
(s) => params.set("ordering", `${s.desc ? "-" : ""}${s.id}`)
|
|
124
|
+
);
|
|
125
|
+
return params;
|
|
126
|
+
}
|
|
127
|
+
function toggleAll() {
|
|
128
|
+
if (isAllSelected.value) {
|
|
129
|
+
const next = { ...rowSelection.value };
|
|
130
|
+
for (const r of rows.value) delete next[pkOf(r)];
|
|
131
|
+
rowSelection.value = next;
|
|
132
|
+
} else {
|
|
133
|
+
const next = { ...rowSelection.value };
|
|
134
|
+
for (const r of rows.value) next[pkOf(r)] = true;
|
|
135
|
+
rowSelection.value = next;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function toggleRowByKey(key) {
|
|
139
|
+
const next = { ...rowSelection.value };
|
|
140
|
+
if (next[key]) delete next[key];
|
|
141
|
+
else next[key] = true;
|
|
142
|
+
rowSelection.value = next;
|
|
143
|
+
}
|
|
144
|
+
const quickEditOpen = ref(false);
|
|
145
|
+
const quickEditId = ref(null);
|
|
146
|
+
function openQuickEdit(id) {
|
|
147
|
+
quickEditId.value = id;
|
|
148
|
+
quickEditOpen.value = true;
|
|
149
|
+
}
|
|
150
|
+
function onQuickEditSaved(updated) {
|
|
151
|
+
if (offlineMode.value) {
|
|
152
|
+
const lk = props.lookup;
|
|
153
|
+
const next = (props.items ?? []).map(
|
|
154
|
+
(r) => String(atKey(r, lk)) === String(atKey(updated, lk)) ? updated : r
|
|
155
|
+
);
|
|
156
|
+
emit("update:items", next);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (hybridMode.value) hybridLoaded.value = false;
|
|
160
|
+
refresh();
|
|
161
|
+
}
|
|
162
|
+
const quickEditLocalItem = computed(() => {
|
|
163
|
+
if (!offlineMode.value || quickEditId.value == null) return null;
|
|
164
|
+
return (props.items ?? []).find(
|
|
165
|
+
(r) => String(atKey(r, props.lookup)) === String(quickEditId.value)
|
|
166
|
+
) ?? null;
|
|
167
|
+
});
|
|
168
|
+
async function deleteRow(item) {
|
|
169
|
+
const ok = await confirm.ask({
|
|
170
|
+
title: t("mapo.listTable.deleteItemTitle"),
|
|
171
|
+
message: t("mapo.confirmDelete"),
|
|
172
|
+
confirmText: t("mapo.delete"),
|
|
173
|
+
dangerous: true
|
|
174
|
+
});
|
|
175
|
+
if (!ok) return;
|
|
176
|
+
if (offlineMode.value) {
|
|
177
|
+
const next = (props.items ?? []).filter(
|
|
178
|
+
(r) => String(atKey(r, props.lookup)) !== String(atKey(item, props.lookup))
|
|
179
|
+
);
|
|
180
|
+
emit("update:items", next);
|
|
181
|
+
snack.show(t("mapo.listTable.itemDeleted"), "success");
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
await crud.delete(atKey(item, props.lookup));
|
|
186
|
+
snack.show(t("mapo.listTable.itemDeleted"), "success");
|
|
187
|
+
if (hybridMode.value) hybridLoaded.value = false;
|
|
188
|
+
refresh();
|
|
189
|
+
} catch {
|
|
190
|
+
snack.show(t("mapo.listTable.deleteItemError"), "error");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const canReorder = computed(
|
|
194
|
+
() => props.draggable && !search.value && sorting.value.length === 0
|
|
195
|
+
);
|
|
196
|
+
const tableWrapper = ref(null);
|
|
197
|
+
const dragFrom = ref(null);
|
|
198
|
+
const dragOverIndex = ref(null);
|
|
199
|
+
function rowElements() {
|
|
200
|
+
return tableWrapper.value ? Array.from(tableWrapper.value.querySelectorAll("tbody tr")) : [];
|
|
201
|
+
}
|
|
202
|
+
function clearRowClasses() {
|
|
203
|
+
for (const el of rowElements())
|
|
204
|
+
el.classList.remove(
|
|
205
|
+
"mapo-drop-before",
|
|
206
|
+
"mapo-drop-after",
|
|
207
|
+
"mapo-drag-source"
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
function clearDragState() {
|
|
211
|
+
clearRowClasses();
|
|
212
|
+
dragFrom.value = null;
|
|
213
|
+
dragOverIndex.value = null;
|
|
214
|
+
}
|
|
215
|
+
function onDragStart(idx) {
|
|
216
|
+
if (!canReorder.value) return;
|
|
217
|
+
dragFrom.value = idx;
|
|
218
|
+
}
|
|
219
|
+
function onRowDragOver(e) {
|
|
220
|
+
if (dragFrom.value === null) return;
|
|
221
|
+
e.preventDefault();
|
|
222
|
+
const tr = e.target?.closest(
|
|
223
|
+
"tbody tr"
|
|
224
|
+
);
|
|
225
|
+
if (!tr) return;
|
|
226
|
+
const els = rowElements();
|
|
227
|
+
const idx = els.indexOf(tr);
|
|
228
|
+
if (idx < 0) return;
|
|
229
|
+
const rect = tr.getBoundingClientRect();
|
|
230
|
+
const before = e.clientY < rect.top + rect.height / 2;
|
|
231
|
+
clearRowClasses();
|
|
232
|
+
tr.classList.add(before ? "mapo-drop-before" : "mapo-drop-after");
|
|
233
|
+
els[dragFrom.value]?.classList.add("mapo-drag-source");
|
|
234
|
+
dragOverIndex.value = idx;
|
|
235
|
+
}
|
|
236
|
+
function onRowDrop(e) {
|
|
237
|
+
e.preventDefault();
|
|
238
|
+
const from = dragFrom.value;
|
|
239
|
+
const to = dragOverIndex.value;
|
|
240
|
+
clearDragState();
|
|
241
|
+
if (from !== null && to !== null) void onDrop(from, to);
|
|
242
|
+
}
|
|
243
|
+
function onDragEnd() {
|
|
244
|
+
clearDragState();
|
|
245
|
+
}
|
|
246
|
+
async function onDrop(fromIdx, toIdx) {
|
|
247
|
+
if (fromIdx === toIdx) return;
|
|
248
|
+
const arr = [...rows.value];
|
|
249
|
+
const moved = arr[fromIdx];
|
|
250
|
+
const target = arr[toIdx];
|
|
251
|
+
arr.splice(fromIdx, 1);
|
|
252
|
+
arr.splice(toIdx, 0, moved);
|
|
253
|
+
rows.value = arr;
|
|
254
|
+
if (offlineMode.value) {
|
|
255
|
+
const lk = props.lookup;
|
|
256
|
+
const full = [...props.items ?? []];
|
|
257
|
+
const fIdx = full.findIndex(
|
|
258
|
+
(r) => String(atKey(r, lk)) === String(atKey(moved, lk))
|
|
259
|
+
);
|
|
260
|
+
const tIdx = full.findIndex(
|
|
261
|
+
(r) => String(atKey(r, lk)) === String(atKey(target, lk))
|
|
262
|
+
);
|
|
263
|
+
if (fIdx >= 0 && tIdx >= 0) {
|
|
264
|
+
const [m] = full.splice(fIdx, 1);
|
|
265
|
+
full.splice(tIdx, 0, m);
|
|
266
|
+
emit("update:items", full);
|
|
267
|
+
}
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
try {
|
|
271
|
+
await crud.updateOrder(
|
|
272
|
+
atKey(moved, props.lookup),
|
|
273
|
+
atKey(target, props.lookup)
|
|
274
|
+
);
|
|
275
|
+
snack.show(t("mapo.listTable.orderSaved"), "success");
|
|
276
|
+
if (hybridMode.value) {
|
|
277
|
+
hybridLoaded.value = false;
|
|
278
|
+
refresh();
|
|
279
|
+
}
|
|
280
|
+
} catch {
|
|
281
|
+
snack.show(t("mapo.listTable.orderError"), "error");
|
|
282
|
+
refresh();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function applyOffline(source) {
|
|
286
|
+
let arr = [...source];
|
|
287
|
+
if (search.value) {
|
|
288
|
+
const q = search.value.toLowerCase();
|
|
289
|
+
arr = arr.filter(
|
|
290
|
+
(row) => props.columns.some(
|
|
291
|
+
(c) => String(row[c.key] ?? "").toLowerCase().includes(q)
|
|
292
|
+
)
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
for (const [key, rawVal] of Object.entries(props.filterParams ?? {})) {
|
|
296
|
+
if (rawVal == null || rawVal === "") continue;
|
|
297
|
+
const parts = String(rawVal).split(",");
|
|
298
|
+
const isDateRange = parts.length === 2 && parts.every((p) => !Number.isNaN(Date.parse(p)));
|
|
299
|
+
if (isDateRange) {
|
|
300
|
+
const [start2, end] = parts;
|
|
301
|
+
arr = arr.filter((row) => {
|
|
302
|
+
const v = atKey(row, key);
|
|
303
|
+
if (v == null) return false;
|
|
304
|
+
const s = String(v);
|
|
305
|
+
return s >= start2 && s <= end;
|
|
306
|
+
});
|
|
307
|
+
} else if (parts.length > 1) {
|
|
308
|
+
const set = new Set(parts);
|
|
309
|
+
arr = arr.filter((row) => set.has(String(atKey(row, key))));
|
|
310
|
+
} else {
|
|
311
|
+
arr = arr.filter((row) => String(atKey(row, key)) === parts[0]);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (sorting.value.length) {
|
|
315
|
+
const sortDefs = sorting.value;
|
|
316
|
+
arr.sort((a, b) => {
|
|
317
|
+
for (const s of sortDefs) {
|
|
318
|
+
const av = atKey(a, s.id);
|
|
319
|
+
const bv = atKey(b, s.id);
|
|
320
|
+
if (av == null && bv == null) continue;
|
|
321
|
+
if (av == null) return 1;
|
|
322
|
+
if (bv == null) return -1;
|
|
323
|
+
if (av < bv) return s.desc ? 1 : -1;
|
|
324
|
+
if (av > bv) return s.desc ? -1 : 1;
|
|
325
|
+
}
|
|
326
|
+
return 0;
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
total.value = arr.length;
|
|
330
|
+
const start = pagination.value.pageIndex * pagination.value.pageSize;
|
|
331
|
+
if (arr.length > 0 && start >= arr.length) {
|
|
332
|
+
pagination.value = { ...pagination.value, pageIndex: 0 };
|
|
333
|
+
rows.value = arr.slice(0, pagination.value.pageSize);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
rows.value = arr.slice(start, start + pagination.value.pageSize);
|
|
337
|
+
}
|
|
338
|
+
async function fetchAll() {
|
|
339
|
+
loading.value = true;
|
|
340
|
+
try {
|
|
341
|
+
const endpointParams = splitEndpointParams(props.endpoint).params;
|
|
342
|
+
const res = await crud.list(endpointParams);
|
|
343
|
+
let nextItems = [];
|
|
344
|
+
if (props.responseAdapter) {
|
|
345
|
+
nextItems = props.responseAdapter(res).items;
|
|
346
|
+
} else if (res && typeof res === "object" && "results" in res) {
|
|
347
|
+
nextItems = res.results;
|
|
348
|
+
} else {
|
|
349
|
+
nextItems = res;
|
|
350
|
+
}
|
|
351
|
+
fullDataset.value = nextItems;
|
|
352
|
+
hybridLoaded.value = true;
|
|
353
|
+
} catch {
|
|
354
|
+
snack.show(t("mapo.loadError"), "error");
|
|
355
|
+
} finally {
|
|
356
|
+
loading.value = false;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
async function refresh() {
|
|
360
|
+
if (offlineMode.value) {
|
|
361
|
+
applyOffline(props.items ?? []);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
if (hybridMode.value) {
|
|
365
|
+
if (!hybridLoaded.value) await fetchAll();
|
|
366
|
+
applyOffline(fullDataset.value);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
loading.value = true;
|
|
370
|
+
try {
|
|
371
|
+
const endpointParams = splitEndpointParams(props.endpoint).params;
|
|
372
|
+
const pageState = {
|
|
373
|
+
page: pagination.value.pageIndex + 1,
|
|
374
|
+
pageSize: pagination.value.pageSize
|
|
375
|
+
};
|
|
376
|
+
const paginationP = props.paginationParams ? props.paginationParams(pageState) : { page: pageState.page, page_size: pageState.pageSize };
|
|
377
|
+
const params = {
|
|
378
|
+
...endpointParams,
|
|
379
|
+
...props.filterParams ?? {},
|
|
380
|
+
...paginationP
|
|
381
|
+
};
|
|
382
|
+
if (search.value) params.search = search.value;
|
|
383
|
+
if (sorting.value.length)
|
|
384
|
+
params.ordering = sorting.value.map((s) => `${s.desc ? "-" : ""}${s.id}`).join(",");
|
|
385
|
+
const res = await crud.list(params);
|
|
386
|
+
let nextItems = [];
|
|
387
|
+
let nextTotal = 0;
|
|
388
|
+
if (props.responseAdapter) {
|
|
389
|
+
const adapted = props.responseAdapter(res);
|
|
390
|
+
nextItems = adapted.items;
|
|
391
|
+
nextTotal = adapted.total;
|
|
392
|
+
} else if (res && typeof res === "object" && "results" in res) {
|
|
393
|
+
nextItems = res.results;
|
|
394
|
+
nextTotal = res.count;
|
|
395
|
+
} else {
|
|
396
|
+
nextItems = res;
|
|
397
|
+
nextTotal = res.length;
|
|
398
|
+
}
|
|
399
|
+
if (nextItems.length === 0 && nextTotal > 0 && pagination.value.pageIndex > 0) {
|
|
400
|
+
pagination.value = { ...pagination.value, pageIndex: 0 };
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
rows.value = nextItems;
|
|
404
|
+
total.value = nextTotal;
|
|
405
|
+
} catch {
|
|
406
|
+
snack.show(t("mapo.loadError"), "error");
|
|
407
|
+
} finally {
|
|
408
|
+
loading.value = false;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
watch([() => props.endpoint, () => props.clientSide], () => {
|
|
412
|
+
hybridLoaded.value = false;
|
|
413
|
+
});
|
|
414
|
+
const filterParamsKey = computed(
|
|
415
|
+
() => JSON.stringify(props.filterParams ?? {})
|
|
416
|
+
);
|
|
417
|
+
watch(
|
|
418
|
+
[
|
|
419
|
+
() => props.endpoint,
|
|
420
|
+
() => props.items,
|
|
421
|
+
filterParamsKey,
|
|
422
|
+
() => pagination.value.pageIndex,
|
|
423
|
+
() => pagination.value.pageSize,
|
|
424
|
+
sorting,
|
|
425
|
+
search
|
|
426
|
+
],
|
|
427
|
+
([newEndpoint, , newFilters], [oldEndpoint, , oldFilters]) => {
|
|
428
|
+
const contextChanged = newEndpoint !== oldEndpoint || newFilters !== oldFilters;
|
|
429
|
+
if (contextChanged && pagination.value.pageIndex !== 0) {
|
|
430
|
+
pagination.value = { ...pagination.value, pageIndex: 0 };
|
|
431
|
+
} else {
|
|
432
|
+
refresh();
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
{ immediate: true, deep: true }
|
|
436
|
+
);
|
|
437
|
+
const UCheckbox = resolveComponent("UCheckbox");
|
|
438
|
+
const UButton = resolveComponent("UButton");
|
|
439
|
+
const UIcon = resolveComponent("UIcon");
|
|
440
|
+
const tableColumns = computed(() => {
|
|
441
|
+
const cols = [];
|
|
442
|
+
cols.push({
|
|
443
|
+
id: "__select__",
|
|
444
|
+
header: () => h(UCheckbox, {
|
|
445
|
+
modelValue: isAllSelected.value,
|
|
446
|
+
indeterminate: isIndeterminate.value,
|
|
447
|
+
"onUpdate:modelValue": toggleAll,
|
|
448
|
+
ariaLabel: t("mapo.listTable.selectAllRows")
|
|
449
|
+
}),
|
|
450
|
+
cell: ({ row }) => {
|
|
451
|
+
const k = pkOf(row.original);
|
|
452
|
+
return h(UCheckbox, {
|
|
453
|
+
modelValue: !!rowSelection.value[k],
|
|
454
|
+
"onUpdate:modelValue": () => toggleRowByKey(k),
|
|
455
|
+
ariaLabel: t("mapo.listTable.selectRow")
|
|
456
|
+
});
|
|
457
|
+
},
|
|
458
|
+
meta: { class: { th: "w-10", td: "w-10" } }
|
|
459
|
+
});
|
|
460
|
+
if (props.draggable) {
|
|
461
|
+
cols.push({
|
|
462
|
+
id: "__drag__",
|
|
463
|
+
header: "",
|
|
464
|
+
cell: ({ row }) => h(
|
|
465
|
+
"span",
|
|
466
|
+
{
|
|
467
|
+
class: canReorder.value ? "cursor-grab text-muted" : "cursor-not-allowed text-muted opacity-30",
|
|
468
|
+
draggable: canReorder.value,
|
|
469
|
+
title: canReorder.value ? t("mapo.listTable.dragToReorder") : t("mapo.listTable.clearToReorder"),
|
|
470
|
+
onDragstart: (e) => {
|
|
471
|
+
e.dataTransfer?.setData("text/plain", "");
|
|
472
|
+
onDragStart(row.index);
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
h(UIcon, { name: "i-lucide-grip-vertical", class: "h-4 w-4" })
|
|
476
|
+
),
|
|
477
|
+
meta: { class: { th: "w-8", td: "w-8" } }
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
const NuxtLink = resolveComponent("NuxtLink");
|
|
481
|
+
for (let i = 0; i < props.columns.length; i++) {
|
|
482
|
+
const col = props.columns[i];
|
|
483
|
+
const isFirst = i === 0 && !!props.detailBase;
|
|
484
|
+
cols.push({
|
|
485
|
+
accessorKey: col.key,
|
|
486
|
+
header: col.label,
|
|
487
|
+
cell: ({ row }) => {
|
|
488
|
+
const cellSlot = slots[`cell.${col.key}`];
|
|
489
|
+
if (cellSlot)
|
|
490
|
+
return cellSlot({
|
|
491
|
+
item: row.original,
|
|
492
|
+
value: atKey(row.original, col.key)
|
|
493
|
+
});
|
|
494
|
+
const cellVal = atKey(row.original, col.key);
|
|
495
|
+
if (isFirst) {
|
|
496
|
+
return h(
|
|
497
|
+
NuxtLink,
|
|
498
|
+
{
|
|
499
|
+
to: `${props.detailBase}/${atKey(row.original, props.lookup)}`,
|
|
500
|
+
class: "font-medium hover:underline"
|
|
501
|
+
},
|
|
502
|
+
() => String(cellVal ?? "\u2014")
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
return String(cellVal ?? "\u2014");
|
|
506
|
+
},
|
|
507
|
+
meta: { class: { td: col.class ?? "" } }
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
cols.push({
|
|
511
|
+
id: "__actions__",
|
|
512
|
+
header: "",
|
|
513
|
+
cell: ({ row }) => {
|
|
514
|
+
const buttons = [];
|
|
515
|
+
if (props.editFields.length > 0 && canEditRow.value) {
|
|
516
|
+
buttons.push(
|
|
517
|
+
h(UButton, {
|
|
518
|
+
size: "xs",
|
|
519
|
+
variant: "ghost",
|
|
520
|
+
color: "neutral",
|
|
521
|
+
icon: "i-lucide-pencil",
|
|
522
|
+
onClick: () => openQuickEdit(
|
|
523
|
+
atKey(row.original, props.lookup)
|
|
524
|
+
)
|
|
525
|
+
})
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
if (canDeleteRow.value) {
|
|
529
|
+
buttons.push(
|
|
530
|
+
h(UButton, {
|
|
531
|
+
size: "xs",
|
|
532
|
+
variant: "ghost",
|
|
533
|
+
color: "error",
|
|
534
|
+
icon: "i-lucide-trash-2",
|
|
535
|
+
onClick: () => deleteRow(row.original)
|
|
536
|
+
})
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
return h(
|
|
540
|
+
"div",
|
|
541
|
+
{ class: "flex items-center gap-1 justify-end" },
|
|
542
|
+
buttons
|
|
543
|
+
);
|
|
544
|
+
},
|
|
545
|
+
meta: { class: { th: "text-right", td: "text-right" } }
|
|
546
|
+
});
|
|
547
|
+
return cols;
|
|
548
|
+
});
|
|
549
|
+
const paginationOptions = computed(() => ({
|
|
550
|
+
manualPagination: true,
|
|
551
|
+
rowCount: total.value
|
|
552
|
+
}));
|
|
553
|
+
const sortingOptions = computed(() => ({
|
|
554
|
+
manualSorting: true
|
|
555
|
+
}));
|
|
556
|
+
</script>
|
|
557
|
+
|
|
558
|
+
<template>
|
|
559
|
+
<div class="mapo-list-table space-y-3">
|
|
560
|
+
<!-- Search -->
|
|
561
|
+
<div v-if="searchable" class="flex items-center gap-2">
|
|
562
|
+
<UInput
|
|
563
|
+
:model-value="search"
|
|
564
|
+
:placeholder="t('mapo.search')"
|
|
565
|
+
icon="i-lucide-search"
|
|
566
|
+
size="sm"
|
|
567
|
+
class="max-w-xs"
|
|
568
|
+
@update:model-value="onSearchInput"
|
|
569
|
+
/>
|
|
570
|
+
<slot name="dtable.toolbar" />
|
|
571
|
+
</div>
|
|
572
|
+
|
|
573
|
+
<!-- Table — the drop area spans the whole row via delegated DnD on this wrapper. -->
|
|
574
|
+
<div
|
|
575
|
+
ref="tableWrapper"
|
|
576
|
+
@dragover="onRowDragOver"
|
|
577
|
+
@drop="onRowDrop"
|
|
578
|
+
@dragend="onDragEnd"
|
|
579
|
+
>
|
|
580
|
+
<UTable
|
|
581
|
+
:data="rows"
|
|
582
|
+
:columns="tableColumns"
|
|
583
|
+
:loading="loading"
|
|
584
|
+
:pagination="pagination"
|
|
585
|
+
:pagination-options="paginationOptions"
|
|
586
|
+
:sorting="sorting"
|
|
587
|
+
:sorting-options="sortingOptions"
|
|
588
|
+
:empty="t('mapo.listTable.noItems')"
|
|
589
|
+
@update:pagination="pagination = $event ?? pagination"
|
|
590
|
+
@update:sorting="sorting = $event ?? sorting"
|
|
591
|
+
>
|
|
592
|
+
<template #empty>
|
|
593
|
+
<slot name="dtable.empty">
|
|
594
|
+
<div class="flex flex-col items-center gap-2 py-8 text-muted">
|
|
595
|
+
<UIcon name="i-lucide-inbox" class="h-8 w-8" />
|
|
596
|
+
<span class="text-sm">{{ t("mapo.listTable.noItems") }}</span>
|
|
597
|
+
</div>
|
|
598
|
+
</slot>
|
|
599
|
+
</template>
|
|
600
|
+
|
|
601
|
+
<template #loading>
|
|
602
|
+
<slot name="dtable.loading">
|
|
603
|
+
<div class="flex justify-center py-8">
|
|
604
|
+
<UIcon
|
|
605
|
+
name="i-lucide-loader-circle"
|
|
606
|
+
class="h-6 w-6 animate-spin text-muted"
|
|
607
|
+
/>
|
|
608
|
+
</div>
|
|
609
|
+
</slot>
|
|
610
|
+
</template>
|
|
611
|
+
</UTable>
|
|
612
|
+
</div>
|
|
613
|
+
|
|
614
|
+
<!-- Pagination controls -->
|
|
615
|
+
<div class="flex items-center justify-between text-sm text-muted">
|
|
616
|
+
<span>{{ t("mapo.listTable.totalItems", { total }) }}</span>
|
|
617
|
+
<UPagination
|
|
618
|
+
:model-value="pagination.pageIndex + 1"
|
|
619
|
+
:total="total"
|
|
620
|
+
:items-per-page="pagination.pageSize"
|
|
621
|
+
size="sm"
|
|
622
|
+
@update:model-value="
|
|
623
|
+
pagination = { ...pagination, pageIndex: $event - 1 }
|
|
624
|
+
"
|
|
625
|
+
/>
|
|
626
|
+
<USelect
|
|
627
|
+
:model-value="pagination.pageSize"
|
|
628
|
+
:items="
|
|
629
|
+
pageSizeOptions.map((n) => ({
|
|
630
|
+
label: t('mapo.listTable.perPage', { n }),
|
|
631
|
+
value: n
|
|
632
|
+
}))
|
|
633
|
+
"
|
|
634
|
+
size="xs"
|
|
635
|
+
class="w-28"
|
|
636
|
+
@update:model-value="
|
|
637
|
+
pagination = { pageIndex: 0, pageSize: Number($event) }
|
|
638
|
+
"
|
|
639
|
+
/>
|
|
640
|
+
</div>
|
|
641
|
+
|
|
642
|
+
<!-- Quick edit modal -->
|
|
643
|
+
<MapoListQuickEdit
|
|
644
|
+
v-if="editFields.length > 0"
|
|
645
|
+
v-model:open="quickEditOpen"
|
|
646
|
+
:endpoint="crudBase"
|
|
647
|
+
:item-id="quickEditId"
|
|
648
|
+
:edit-fields="editFields"
|
|
649
|
+
:lookup="lookup"
|
|
650
|
+
:languages="languages"
|
|
651
|
+
:registry="registry"
|
|
652
|
+
:offline="offlineMode"
|
|
653
|
+
:local-item="quickEditLocalItem"
|
|
654
|
+
@saved="onQuickEditSaved"
|
|
655
|
+
>
|
|
656
|
+
<template v-for="(_, name) in $slots" #[name]="slotProps">
|
|
657
|
+
<slot :name="`qedit.${String(name)}`" v-bind="slotProps ?? {}" />
|
|
658
|
+
</template>
|
|
659
|
+
</MapoListQuickEdit>
|
|
660
|
+
</div>
|
|
661
|
+
</template>
|
|
662
|
+
|
|
663
|
+
<style scoped>
|
|
664
|
+
.mapo-list-table :deep(tbody tr.mapo-drag-source){opacity:.4}.mapo-list-table :deep(tbody tr.mapo-drop-before>td){box-shadow:inset 0 2px 0 0 var(--ui-primary,#3b82f6)}.mapo-list-table :deep(tbody tr.mapo-drop-after>td){box-shadow:inset 0 -2px 0 0 var(--ui-primary,#3b82f6)}
|
|
665
|
+
</style>
|